Reputation: 2176
I've read many answers but keep getting 500 server errors so I'm obviously missing something simple.
The food-travel
section has changed to /blog/
and I simply need to redirect all pages under /food-travel/
to /blog/
I've tried many variations but this is what I have currently:
RedirectMatch 301 ^/food-travel[/]?(.*) ^/blog[/]?(.*)
What am I missing? Any pointers in the right direction would be much appreciated.
Upvotes: 0
Views: 282
Reputation: 42925
You'd need to take a look into your http servers error log file for a more precise error message than "status 500". But even like this some things should be changed in your rule. It seems that you did not consider taking a look into the documentation of the RedirectMatch
directive. Have a look over here: https://httpd.apache.org/docs/2.4/mod/mod_alias.html#redirectmatch
Most likely this is close to what you are looking for:
RedirectMatch 301 ^/food-travel/?(.*)$ /blog/$1
Upvotes: 1
Reputation: 1016
Using RewriteRule
RewriteEngine On
RewriteBase /
RewriteRule ^food-travel/(.*)$ /blog/$1 [L,NC,R=301]
or using RedirectMatch
RedirectMatch 301 ^/food-travel/(.*)$ /blog/$1
Upvotes: 0