Greenguy's Board


Go Back   Greenguy's Board > Programming & Scripting
Register FAQ Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 2007-03-24, 10:33 PM   #1
JK
Well you know boys, a nuclear reactor is a lot like women. You just have to read the manual and press the right button
 
Join Date: Nov 2003
Posts: 157
Wordpress 301 Redirect after Permalink Change

I've got a blog that uses wp autoblog and RSS feeds, as well as posts written by me. I want to disallow google from spidering the rss feed content, so I've changed the permalink structure from just /%postname%/ to /%category%/%postname%/, and disallowed the feed category in my robots.txt.

The problem is that now all of the old posts (1000+) will return a 404 error to Google, which is not ideal. I would like to perform a 301 redirect to the new permalink category if the wordpress class wp_query discovers a 404, but the post is actually valid.

Is there a way I can modify the class to do this? Maybe do some kind of mod_rewrite magic?
__________________
To alcohol! The cause of, and solution to, all of life’s problems
JK is offline   Reply With Quote
Old 2007-03-25, 12:06 AM   #2
oldbrad
It is better to watch things then to do them
 
oldbrad's Avatar
 
Join Date: Nov 2006
Location: oregon
Posts: 485
Send a message via AIM to oldbrad Send a message via Yahoo to oldbrad
I was looking for something similar, but didn't seem to work with regular htaccess file.
__________________
Help MrMaryLou
Link to his Chubby TGP & Chubby Links on your sites and blogs.
oldbrad is offline   Reply With Quote
Old 2007-03-25, 06:48 PM   #3
walrus
Oh no, I'm sweating like Roger Ebert
 
walrus's Avatar
 
Join Date: May 2005
Location: Los Angeles
Posts: 1,773
Send a message via ICQ to walrus Send a message via Yahoo to walrus
Quote:
Originally Posted by JK View Post
I've got a blog that uses wp autoblog and RSS feeds, as well as posts written by me. I want to disallow google from spidering the rss feed content, so I've changed the permalink structure from just /%postname%/ to /%category%/%postname%/, and disallowed the feed category in my robots.txt.

The problem is that now all of the old posts (1000+) will return a 404 error to Google, which is not ideal. I would like to perform a 301 redirect to the new permalink category if the wordpress class wp_query discovers a 404, but the post is actually valid.

Is there a way I can modify the class to do this? Maybe do some kind of mod_rewrite magic?
Have you checked out the Permalinks Migration Plugin
__________________
Naked Girlfriend Porn TGP
free partner account
walrus is offline   Reply With Quote
Old 2007-03-25, 09:08 PM   #4
JK
Well you know boys, a nuclear reactor is a lot like women. You just have to read the manual and press the right button
 
Join Date: Nov 2003
Posts: 157
Thanks Walrus

All I needed to do was search for the magic word permalink "migration" not "change, alter, new" etc.

Unfortunately I couldn't get it to work properly, the old posts were performing a 301 redirect to the correct location, however all the posts were returning a 404 error. I'll play around with it a bit more to see if I can figure it out, but it seems there's a few people with the same problems as me.

It's worth mentioning that if you are going to use this plugin, make sure you do it before you change the permalink structure.

Very handy plugin to have.
__________________
To alcohol! The cause of, and solution to, all of life’s problems
JK is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 03:01 PM.


Mark Read
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© Greenguy Marketing Inc