Z
Z
z0rg1s2019-09-05 16:06:10
htaccess
z0rg1s, 2019-09-05 16:06:10

Redirect from one dynamic URL to another via htaccess?

Good day, please tell me how to organize a redirect via htaccess
It is necessary to redirect from the URL:
/?s=DYNAMIC_VALUE&post_type=product&type_aws=true
To:
/?s=DYNAMIC_VALUE
It turns out that I need to remove the extra parameter: &post_type=product&type_aws=true
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2019-09-05
@z0rg1s

RewriteCond %{QUERY_STRING} ^(s=[^&]*)&
RewriteRule (.*) /$1?%1 [R=301,L,NE]

If you need to catch and /?post_type=product&type_aws=true&s=DYNAMIC_VALUE
RewriteCond %{QUERY_STRING} ^(?|(s=[^&]*)&|.*?&(s=[^&]*))
RewriteRule (.*) /$1?%1 [R=301,L,NE]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question