2

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

2 Answers 2

2

Using mod_rewrite:

RewriteEngine On
RewriteCond %{QUERY_STRING} ^(option=com_oldtoys&.*)&start=[0-9]+(.*)$
RewriteRule ^index\.php$ /index.php?%1%2 [L,R=301]
Sign up to request clarification or add additional context in comments.

3 Comments

Hello Jon, Its not working, coming output is:- abc.com/…
Yep, yours too works now. Any comment on Anubhava code - as that too works too, or both are equally good !!! Thanks for your time
@RuchikaModi anubhava's regex is more strict, with the only variance being the Itemid's value and the limitstart's value. There can't be any other parameters, which is good if it's what you want. The regex that I used only needs to start with option=com_oldtoys& and the start parameter can be anywhere along with any other parameters in the query string. Depends on how strict you want the match to be
1

You can use this rule:

RewriteCond %{QUERY_STRING} ^(option=com_oldtoys&view=category&Itemid=[^&]*)&start=[^&]*&(limitstart=[^&]*) [NC]
RewriteRule ^index\.php$ $0?%1&%2 [L,NC,R=301]

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.