Tuesday, 20 August 2013

Changing permalinks using mod_rewrite now gives internal server error 500

Changing permalinks using mod_rewrite now gives internal server error 500

I just changed my wordpress permalinks from
domain.com/%year%/%month%/%post-slug% over to domain.com/%post-slug%
I used the following mod_rewrite rule to redirect all my older URLs to the
new ones.
RedirectMatch 301 ^/[0-9]{4}/[0-9]{2}/([a-z0-9\-/]+) http://www.site.com/$1
The problem being this redirected all my date based archives
domain.com/%year%/%month%/%date% to domain.com/%date% as well which gave
out a 404 error
I modified the above code to include a character count (a minimum of 3 and
a maximum of 300) like this in order to tackle the date problem
RedirectMatch 301 ^/[0-9]{4}/[0-9]{2}/([a-z0-9\-/]{3,300}+)
http://www.site.com/$1
But am now getting a 500 Internal Server error.
Any help on this would be appreciated.

No comments:

Post a Comment