Setting up htaccess file for sub-folder redirection
I have a question regarding htaccess redirecting.
I have a domain called www.test.com and there are so many subfolders in that, like www.test.com/admin/ , www.test.com/users/ etc. I开发者_Go百科 just want to redirect to different URLS based on each URL, i.e,
www.test.com should redirect to www.abc.com
www.test.com/admin/ should redirect to www.xyz.com
www.test.com/users/ should redirect to www.pqr.com
How can I write an htaccess file to redirect to different URLs based on each request (something like checking condition in the incoming URL)?
You want something like:
RewriteEngine on
RewriteRule ^users/(.*)$ http://www.pqr.com/$1 [L,NC,QSA,R=301]
RewriteRule ^admin/(.*)$ http://www.xyz.com/$1 [L,NC,QSA,R=301]
# ... add more rules as needed
RewriteRule ^(.*)$ http://www.abc.com/$1 [L,NC,QSA,R=301]
精彩评论