Answer the question
In order to leave comments, you need to log in
Hataccess redirect with ampersand (&)?
Good afternoon. Tell me how to redirect everything after the ampersand (sign &) in the URL to what is before it, while the ampersand should remain. Example:
/review/report.php?id=1131&item_id=21&PHPSESSID=69c6a854f33cc07d61b81257b45d4cf5
на
/review/report.php?id=1131&item_id=21&
Answer the question
In order to leave comments, you need to log in
?id=1&item_id=2&PHPSESSID=abc
?id=1&PHPSESSID=abc&item_id=2
?PHPSESSID=abc&id=1&item_id=2
RewriteCond %{QUERY_STRING} ^(|.*&)PHPSESSID=[^&]*&?(.*)
RewriteRule ^review/report\.php$ /$0?%1%2 [R=301,L]
The Get parameter is not part of the URL and RewriteRule does not physically see it.
RewriteCond %{QUERY_STRING} (^|&)id\=1131($|&)
RewriteCond %{QUERY_STRING} (^|&)item_id\=21($|&)
RewriteCond %{QUERY_STRING} (^|&)PHPSESSID\=69c6a854f33cc07d61b81257b45d4cf5($|&)
RewriteRule ^review/report\.php$ /review/report.php?id=1131&item_id=21& [L,R=301]
eport.php?id
eport.php\?id
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question