且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

.htaccess中重定向的URL与匹配的字符串

更新时间:2023-02-22 22:12:57

使用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]