Corey
Corey

Reputation: 2563

Moved from Blogger to Wordpress, need to rewrite some URLs

I just recently moved from Blogger to Wordpress.

Blogger's archive URLs were something like this: /2013_08_01_archive.html

I need to rewrite that to /2013/8, I'm assuming in .htaccess. I need to do it where it will work for all past archive links to 2010 or so. Is there a way to make this rewrite work for anything with that pattern?

For example:

/2014_11_01_archive.html -> /2014/11
/2013_10_01_archive.html -> /2013/10
/2009_01_01_archive.html -> /2009/1

Any idea how to do this?

Upvotes: 1

Views: 97

Answers (1)

anubhava
anubhava

Reputation: 785276

You can use this rule in your root .htaccess:

RewriteEngine On

RewriteRule ^(\d{4})_0?(\d{1,2})_\d{2}_archive\.html$ /$1/$2 [NC,L,R]

Upvotes: 2

Related Questions