[英]htaccess 301 redirect of matching string to another domain url
Am trying to redirect url of domain a to domain b, wherein redirection is done to fit in to best possible url of domain b 我正在尝试将域a的网址重定向到域b,其中进行了重定向以适合域b的最佳可能网址
For ex, domain A from which 301 redirect to be done . 例如,从域A进行301重定向。
http://www.abc.com/blog/
http://www.abc.com/old-games?view=pages&layout=sell
There are many pgaes next to blog and many pages as sub url under old-games etc. 博客旁边有很多pgaes,在旧游戏等下还有许多页面作为子URL。
Domain B 域B
http://www.xyz.com/index.php?option=com_blog&view=entry&Itemid=5
http://www.xyz.com/index.php?option=com_forms&view=pages&layout=sellgames&Itemid=10
Have tried below htaccess redirect conditions 在htaccess重定向条件下尝试过
RewriteCond %{REQUEST_URI} ^.*/blog.*$
RewriteRule .* http://www.xyz.com/index.php?option=com_blog&view=entry&Itemid=5 [R=301,L]
RewriteCond %{REQUEST_URI} ^.*/old-games.*$
RewriteRule .* http://www.xyz.com/index.php?option=com_forms&view=pages&layout=sellgames&Itemid=10 [R=301,L]
The redirect is happening to 重定向正在发生
http://www.xyz.com/index.php as tested using http://htaccess.madewithlove.be/
Pl suggest for best way as if missin something in above pl建议最好的方法,好像上面的东西错过了一样
Thanks 谢谢
Replace your code with this: 用以下代码替换代码:
RewriteRule ^blog(/|$) http://www.xyz.com/index.php?option=com_blog&view=entry&Itemid=5 [R=301,L,QSA,NC]
RewriteRule ^old-games(/|$) http://www.xyz.com/index.php?option=com_forms&view=pages&layout=sellgames&Itemid=10 [R=301,L,NC,QSA]
Make sure to test in a different browser or clear your browser cache. 确保在其他浏览器中进行测试或清除浏览器缓存。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.