1

i have the following in htaccess and it works fine

RewriteCond %{REQUEST_URI}  ^/artist\.php$
RewriteCond %{QUERY_STRING} ^bandid=([0-9]*)$ [NC]
RewriteRule ^(.*) /band.php?BandId=%1 [L]

but some old referes send other querystring params:

bandid=1326&order=ASC&orderby=Tdate

to which apache gives them 404

how can i tell mod_rewrite to ignore any other params after bandid

1 Answer 1

3

Replace your code with this:

RewriteCond %{QUERY_STRING} (?:^|&)bandid=([0-9]*)(?:&|$) [NC]
RewriteRule ^artist\.php$ /band.php?BandId=%1 [L,NC]

Regex (^|&)bandid=([0-9]*)(&|$) will make sure to match bandid=1326 irrespective of presence of other query parameters.

Sign up to request clarification or add additional context in comments.

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.