Link to home
Start Free TrialLog in
Avatar of Marisa
MarisaFlag for United States of America

asked on

301 Redirect on changed blog permalinks

I just changed my permalink structure in Wordpress from:

/blog/2012/02/sample-post/

to:

/blog/postname

Because I thought it would be good for SEO. Since Wordpress updates your .htaccess file after changing these settings, I thought it would set up 301 redirects from all the old post URLs to the new ones, but all it did was insert this in there:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>

How do I redirect all the old post URLs to the new ones?

I tried the following, but it didn't work:
redirect 301 /2011/05/drop-a-note-make-a-smile/  http://stadriemblems.com/blog/drop-a-note-make-a-smile/

Open in new window

Avatar of COBOLdinosaur
COBOLdinosaur
Flag of Canada image

try this:

//301 Redirect Entire Directory
RedirectMatch 301 http://stadriemblems.com/blog/postname(.*) http://stadriemblems.com/blog/2012/02/sample-post//$1


Cd&
Avatar of Marisa

ASKER

That may work, but I think I edited my question at the same time you were answering it. I had the 'from' and 'to' permalink structure inverted.

So I inverted the two URLs in your code before I put them in the htaccess but that took me to my home directory and then /500.shtml -- whatever that is. Can you give me code reflecting my updated question, because when I tried to change it, that's what happened.

Thanks!
ASKER CERTIFIED SOLUTION
Avatar of Jason C. Levine
Jason C. Levine
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial