Iftikhar uddin
Iftikhar uddin

Reputation: 3182

How to force redirect query string URL with htaccess?

I want to redirect example.com/recipes/signup?code=OLD277 to example.com/recipes-user/register How can I achieve it via htacces?

I tried the below code in .htaccess but its not working!

Redirect /recipes/signup?code=OLD277 http://example.com/recipes-user/register

Upvotes: 1

Views: 22

Answers (1)

anubhava
anubhava

Reputation: 785008

You may use this rule as your topmost rule in site root .htaccess:

RewriteEngine On

RewriteCond %{THE_REQUEST} /recipes/signup\?code=OLD277\s [NC]
RewriteRule . /recipes-user/register? [R=301,L,NE]

Upvotes: 1

Related Questions