简体   繁体   中英

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

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]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM