I'm trying to match the following URL's: http://site.com/category/page/number/?s= http://site.com/page/number/?s=TEXT and redirect it to: http://site.com/?s=TEXT Any help would be appreciated! Thanks
How and where are you matching them? .htaccess? Within the pages? ...? Anyway, the pattern would be something like: '~^http://(www\.)?site\.com/([\w-]+/)?page/\d+/\?s=(.*?)$~' PHP:
sometimes querystring is to be checked separately RewriteCond %{QUERY_STRING} ^(.*)s=(.*)$ RewriteRule ^(category)?/page/number/$ /?s=%2 Code (markup):
Thanks guys! Got it to work, my problem was I forgot to escape the ? character. I used /page/(0-9)+/\?s=* And 301 redirect it to /?s=* I was using this in the WordPress redirection plugin.