Tutorial :Redirect domain.com/folder to folder.domain.com permanently


Possible Duplicates
how can I use mod rewrite to redirect a folder to a subdomain ...
Apache rewrite based on subdomain (backwards)

I have catch all rules set up and a subdomain working fine.

However it's still possible to get to a part of my site from http://example.com/subdomain rather than http://subdomain.example.com/

How would I force a permanent redirect?

I'm assuming it's something like:

RewriteCond %{HTTP_HOST} ^example\.com$ [NC]  # (rule to see if i am inside subdomain folder)  RewriteRule ^(.*)$ http://www.subdomain.example.com/$1 [R=301,L]  


you would use this line in your main .htaccess for a simple folder 301 "Moved/Permanent" Redirect

Redirect 301 /subdomain http://subdomain.example.com  


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »