I'm trying to do a redirect with a .htaccess file matching these specific requirement:
- The page/script name is foo.php
- The querystring must contain p=1
- There could be any number of other querystring variables present
If these conditions are met, you should be redirected to: /new-url/
This is what I've come up with that doesn't work. It matches and redirects /foo.php but not /foo.php?p=1 or /foo.php?p=1&x=5
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} ^foo\.php$ [NC]
RewriteCond %{QUERY_STRING} (^|&)p=1(&|$) [NC]
RewriteRule . new-url/? [R=301,L]
Thanks very much in advance for any assistance!