Reputation: 8418
I have a situation where I need to create multiple redirects.
I want to redirect /blog to /food, which can be easily done by
Redirect 301 /blog /food
But then I also need to redirect /blog/example to /another-example. But because I created the former redirect, this is what ends up happening:
/blog/example
becomes
/food/example
instead of
/another-example
because it's changing /blog to /food before considering anything else.
Any help? Thanks!
Upvotes: 1
Views: 29
Reputation: 41219
Redirect directive matches rest of the uri and appends it to the destination. To redirect a specific uri, you need to use RedirectMatch.
RedirectMatch 301 ^/blog/?$ /food
Clear your browse cache before testing this.
Upvotes: 2