A
A
ali19992021-12-13 15:08:04
URL Handling
ali1999, 2021-12-13 15:08:04

301 redirect intercepting GET parameters?

Hello, I have the following problem:

I need to make a 301 redirect with GET parameters removed.

Here is what I wrote in htaccess:

RewriteCond %{REQUEST_URI} /product-category/cpap/
RewriteCond %{QUERY_STRING} ^pa_brands=mercury-medical
RewriteRule ^(.*)$ https://mysite.com/catalog/sistemy-dlya -cpap-therapy/ ? [R=301,L]

I was supposed to get: https://mysite.com/catalog/sistemy-dlya-cpap-terapii/

and I end up with a URL with GET parameters:
https://mysite.com/catalog/ sistemy-dlya-cpap-terap...

What could be causing this problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Taran, 2021-12-13
@shambler81

RewriteCond %{QUERY_STRING} (?:^|&)pa_brands\=mercury\-medical(?:$|&)
RewriteRule ^product\-category/cpap/$ /catalog/sistemy\-dlya\-cpap\-terapii/? [L,R=301]

and here is a gift for you
https://donatstudios.com/RewriteRule_Generator

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question