I asked the question in WPSE before, but the answer I got so far is a complicated one. I'm actually looking for a .htaccess
way. Here's what the scenario is:
My blog archive URLs were like:
http://example.com/2014/03
I changed my site's permalink from /%postname%/
to /%postid%/%postname%/
, and using Redirection plugin, I set a redirection like:
and it's working. But the problem occurs in the archive URLs. The new archive URL generated with a /date/ basename before the dates, like:
http://example.com/date/2014/03
I'm trying to use the same Redirection plugin to redirect the URL, but failed:
I then tried writing .htaccess
on my own (with no .htaccess
writing experience) with:
Redirect permanent http://example.com/([0-9]+)/([0-9]+) http://example.com/date/([0-9]+)/([0-9]+)
with the help of htaccess editor and this blog. But failed too.
How can I let my blog not to get 404 on such archive URL? I'm afraid, I'm dumb with rewrite rule till now. :(
UPDATE
Here's how my .htaccess
file just now:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
And with Liam Sorsby's answer, I tried pasting the code
RewriteEngine on
RewriteRule ^([0-9]+)/([0-9]+)$ /date/$1/$2 [R=301,L]
just below the # END WordPress
once, and then tried again just before # END WordPress. But both time failed.