Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

This should be simple right? I've tried a few solutions with no results...

How do I redirect:  

http://www.domainname.com/subdomain   and    http://www.domainname.com/subdomain/    


htt://subdomain/domainname.com   and   htt://subdomain/domainname.com/


What code should I use, and do I place it in .htaccess of the domainname.com root folder?

or in the subdomain folder?

Thanks so much!


share|improve this question

2 Answers 2

I'm presumming a typo in your request and that you wish to redirect:

http://www.domainname.com/subdomain ----> http://subdomain.domainname.com

If you are using apache, I'd use the following directive in the httpd.conf file:

Redirect /subdomain http://subdomain.domainname.com
share|improve this answer
I'm using Apache. what is the httpd.conf file? Wouldn't I be adding that code to my .htaccess file? Would this go in the subdomain folder then or the domainname.com root folder? Thanks! –  JD Sep 18 '09 at 23:22
I placed your code in the .htaccess file in the subdomain folder and got the following error: Common reasons for this error are: * Incorrect file/directory permissions: Above 755. In order files to be processed by the webserver, their permissions have to be equal or below 755. You can update file permissions with a FTP client or through cPanel's File Manager. * Incorrect Apache directives inside .htaccess file. Make sure you have not specified unsupported directives inside the local .htaccess file. Such include PHP settings and Apache module settings. –  JD Sep 18 '09 at 23:25
I checked my error log ---- Invalid command 're', perhaps mis-spelled or defined by a module not included in the server configuration --- –  JD Sep 18 '09 at 23:28
Here is the URI that describes the directive: httpd.apache.org/docs/2.2/mod/mod_alias.html#redirect –  mdpc Sep 18 '09 at 23:55

And if you're using IIS, set up redirects in the site properties in the IIS management snapin.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.