Forum Moderators: phranque
RewriteCond %{QUERY_STRING} &?[a-z] [NC]
RewriteRule ^index\.php$ [my-site.com...] [R=301,L]
I do not want anyone to write the code, I would just like assistance so that I can fix this myself.
Using this code I am trying to redirect anything using index.php followed immediately by a question mark only (index.php?), as some urls are indexed as index.php/someothername/
I realize to redirect numeric queries I will need to add that as well, but so far I would like to start by getting this working first.
Much Regards,
Todd
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\?category_name=(.*)\ HTTP/
RewriteRule ^index\.php$ [mysite.com...] [R=301,L]
Thanks for the help on this forum JD.
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\?category_name=([^\ ]*)\ HTTP/
As shown, the pattern will match anything after "name=", up to the first space that it finds.
You could also use ([^&\ ]+) to match up to the next space OR query-string parameter, if there is a chance you will ever have more than one parameter -- Or that someone might try to cause you trouble by adding fake query string parameters in a link.
Jim