Thursday, 12 September 2013

Permalink Redirection and Regular Expressions

Permalink Redirection and Regular Expressions

I've got a pretty basic RegEx question but it's pressing enough that I
don't have time to run down a tutorial on RegEx in order to answer it
myself.
In short, I need: /2009/01/28/post-name/
redirected to /post-name/
As well as /post-name/author-name/
redirected to /post-name/
I promise to go take a class in RegEx before the month is out. Deal?
PS. Yes, I know that the Wordpress Redirection plugin will automate
.htaccess but it won't write RegEx for me.



Solved using the Redirection plugin.
Source URL: /(\d*)/(\d*)/(\d*)/([A-Za-z0-9-]*) Target URL: /$4

No comments:

Post a Comment