简体   繁体   中英

Redirection of URL with question mark

Hi I need help with a RewriteRule to forward the folling url:

https://example.com/ipsum-lorem-amit/?lang=en

to

https://example.com/en/a-newpage-here

I tried the following code, but it doesn't work

RewriteCond %{REQUEST_URI} ^/tipsum-lorem-amit/?lang=en [NC]
RewriteCond %{QUERY_STRING} lang=en [NC]
RewriteRule ^(.*) %{REQUEST_URI}/en/a-newpage-here [R,L]

Thanks for your help

You may use this rule as your ` top most rule :

RewriteEngine On

RewriteCond %{QUERY_STRING} ^lang=([a-z]+)$ [NC]
RewriteRule ^tipsum-lorem-amit/?$ /%1/a-newpage-here? [R=301,NC,L]

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