简体   繁体   中英

How to redirect to specific path with .htacces?

Im writing Redirect Rule and came up on a problem that could interest some of you.

The idea is to redirect old path voyage/grece/mykonos/ to new path voyage/cyclades/mykonos/

But whatever i tried failed and redirect me to strange url :/ ->

http://www.agencedevoyage.com/voyage/europe/cyclades/mykonos/?continent=europe&country=grece&town=mykonos&type=voyage

Does that mean the php traitement is done without refreshing the page or something like that ? How can I avoid this ?

Rules I tried :

ReWriteRule \/voyage\/europe\/grece\/mykonos\/  http://www.agencedevoyage.com/voyage/europe/cyclades/mykonos/ [R=301,L]

RedirectPermanent /voyage/europe/grece/mykonos/ http://www.agencedevoyage.com/voyage/europe/cyclades/mykonos/

Try this

RewriteRule ^/voyage/europe/grece/mykonos/$ http://www.agencedevoyage.com/voyage/europe/cyclades/mykonos/ [R=301,L]

Or

Redirect 301 /voyage/europe/grece/mykonos/   http://www.agencedevoyage.com/voyage/europe/cyclades/mykonos/

Make sure that the opening of the .htaccess file contains the 2 lines of code below which enables the Apache module to rewrite the URLS, then place your redirections below them

Options +FollowSymLinks
RewriteEngine On

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