0

I am trying to rewrite url with htaccess from

https://www.example.com/cozumel/...

to

https://www.example.com/cozumel-shore-excursions/...

I tried like this

RewriteEngine On
RewriteRule ^/cozumel\/(.*) /cozumel-shore-excursions/$1 [L,R=301]

2 Answers2

0

Try using this line:

RewriteRule ^cozumel/$ /cozumel-shore-excursions/?&%{QUERY_STRING}
Joe
  • 4,877
  • 5
  • 30
  • 51
  • That whole query string thing is not necessary. You can just pass the `[QSA]` (stands for "query string append") flag and apache will handle including any additional query string parameters passed. – Jonathan Kuhn Jun 16 '16 at 17:23
0

just remove the leading slash from your rule's pattern :

RewriteEngine On
RewriteRule ^cozumel/(.*) /cozumel-shore-excursions/$1 [L,R=301]
Amit Verma
  • 40,709
  • 21
  • 93
  • 115