Redirect from old site and subsites to new domain - main page with htaccess
I have the following rules in my .htaccess
rewritecond %{http_host} ^oldname.com [nc]
RewriteRule ^(.*)$ http://www.newname.com [r=301,nc]
rewritecond %{http_host} ^www.oldname.com [nc]
rewriterule ^(.*)$ http://www.newname.com [r=301,nc]
I am wondering how to merge does 2 rules in one. Beside that I would like to redirect if user comes to: www.oldname.com/?action=whatever to开发者_高级运维 newname as well...
Thanks for response!
rewritecond %{http_host} ^(www\.)?oldname.com [nc]
RewriteRule ^(.*)$ http://www.newname.com [r=301,nc]
change the above code to that
rewritecond %{http_host} ^(www\.)?oldname.com [nc]
RewriteRule ^(.*)$ http://www.newname.com/$1 [r=301,nc]
If that not work tell me to give you another solution.
精彩评论