Reputation: 333
I have this url structure right now.
http://example.com/weather/in-city_name
which I want to permanently redirect to
http://example.com/city_name/weather
Here is what I'm writing to the .htaccess file using this reference
RedirectMatch ^/weather/(.*)$ http://example.com/$1/weather
But this doesn't work.
In my condition city_name
is dynamic and manual entry is not possible.
Any suggestion about how to achieve the desire result would be great.
Upvotes: 0
Views: 39
Reputation: 18671
You can use this .htaccess
:
RewriteEngine on
RewriteRule ^weather/in-(.+)/?$ /$1/weather [R=301,NC,L]
Upvotes: 2