开发者

Redirect from old site and subsites to new domain - main page with htaccess

开发者 https://www.devze.com 2023-04-09 19:50 出处:网络
I have the following rules in my .htaccess rewritecond %{http_host} ^oldname.com [nc] RewriteRule ^(.*)$ http://www.newname.com [r=301,nc]

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消