.htaccess中重定向的URL与匹配的字符串 [英] Htaccess Redirection for url with matching string
本文介绍了.htaccess中重定向的URL与匹配的字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在oldtoys需要301重定向帮助所有字符串匹配'开始'参数
生成的不正确的URL
<$p$p><$c$c>http://www.abc.com/index.php?option=com_oldtoys&view=category&Itemid=2&start=45&limitstart=300 http://www.abc.com/index.php?option=com_oldtoys&view=category&Itemid=2&start=30&limitstart=275 http://www.abc.com/index.php?option=com_oldtoys&view=category&Itemid=2&start=15&limitstart=250
正确的网址
<$p$p><$c$c>http://www.abc.com/index.php?option=com_oldtoys&view=category&Itemid=2&limitstart=300 http://www.abc.com/index.php?option=com_oldtoys&view=category&Itemid=2&limitstart=275 http://www.abc.com/index.php?option=com_oldtoys&view=category&Itemid=2&limitstart=250这仅适用于旧玩具部件 可以在其上有人帮忙
解决方案
使用mod_rewrite:
RewriteEngine叙述上
的RewriteCond%{QUERY_STRING} ^(选项= com_oldtoys及放大器; *)及开始= [0-9] + $(*)。
重写规则^指数\ .PHP $ /index.php?%1%2 [L,R = 301]
Need help on 301 redirection for all string matches 'start' parameter in oldtoys
Incorrect URL been generated
http://www.abc.com/index.php?option=com_oldtoys&view=category&Itemid=2&start=45&limitstart=300
http://www.abc.com/index.php?option=com_oldtoys&view=category&Itemid=2&start=30&limitstart=275
http://www.abc.com/index.php?option=com_oldtoys&view=category&Itemid=2&start=15&limitstart=250
Correct URL
http://www.abc.com/index.php?option=com_oldtoys&view=category&Itemid=2&limitstart=300
http://www.abc.com/index.php?option=com_oldtoys&view=category&Itemid=2&limitstart=275
http://www.abc.com/index.php?option=com_oldtoys&view=category&Itemid=2&limitstart=250
This only pertains to old toys component Can someone help on it
解决方案
Using mod_rewrite:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^(option=com_oldtoys&.*)&start=[0-9]+(.*)$
RewriteRule ^index\.php$ /index.php?%1%2 [L,R=301]
这篇关于.htaccess中重定向的URL与匹配的字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文