简体   繁体   中英

issue with .htaccess using 301 Redirection with params

i want to stop parameters from getting appeneded to url

issue with .htaccess i have website say example.com

1: i have to redirect

example.com/deatils.php?366%2520WORDS%2520IN%2520MUMBAI example.com/bookshelf/366_words_in_mumbai

i wrote below code

RewriteRule ^deatils.php?366%2520WORDS%2520IN%2520MUMBAI example.com/bookshelf/366_words_in_mumbai [R=301,L]

but opening example.com/deatils.php?366%2520WORDS%2520IN%2520MUMBAI

redirect to example.com/bookshelf/366_words_in_mumbai?366%252520WORDS%252520IN%252520MUMBAI

i do not want strings after "?" to be appened

Use this additional rule for the redirection in your htaccess and it will work for you.

RewriteCond %{QUERY_STRING} (^|&)366%2520WORDS%2520IN%2520MUMBAI($|&)
RewriteRule ^deatils\.php$ /bookshelf/366_words_in_mumbai? [L,R=301]

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