Forum Moderators: phranque

Message Too Old, No Replies

Need 301 Redirect

301 redirect wordpress

         

transat99

6:23 pm on Sep 5, 2008 (gmt 0)

10+ Year Member



Hi - I have recently made several changes to an old/stagnant Wordpress blog. Unfortunately, I broke most of my old SE and linklist links in the process...

I need to find a way to redirect all pages, such as:

http://www.example.com/archives/2005/05/los-angeles to

http://www.example.com/blog/2008/05/los-angeles

You will notice that the blog is NOW located in a subdirectory "/blog" ... and I have changed the year "/2005" to "/2008". I believe that I can now change the "/archives" part to the subdirectory "/blog" and all the pages will pull up correctly in the search engines.

With .htaccess, I tried adding:

Redirect 301 archives/2005/05 http://www.example.com/blog/2008/05 and

RedirectPermanent archives/2005/05 http://www.example.com/blog/2008/05

but neither worked.

I'm losing LOTS of traffic to 404s. Any assistance would be greatly appreciated! :)

[edited by: jdMorgan at 7:46 pm (utc) on Sep. 5, 2008]
[edit reason] Use example.com please. [/edit]

jdMorgan

7:48 pm on Sep 5, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You did not say what you meant by "didn't work" and unfortunately, that description tells us little. How did you test? What URLs did you request? What was the result? How did the result differ from your expectations?

I note that neither of your Redirect URL-paths begins with the required slash, as shown in the mod_alias documentation...

Jim

Marcia

8:06 pm on Sep 5, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Check out the "permalinks moved permanently" plugin.

transat99

8:08 pm on Sep 5, 2008 (gmt 0)

10+ Year Member



jdMorgan - You are a lifesaver! When I added the "required slash", everything worked! Thanks! :D

I went with the "Redirect 301 /" since it was currently in my .htaccess file. In your opinion, is that the correct choice ... or would I be better going with "RedirectPermanent /"? Or does it really make a difference?

jdMorgan

8:45 pm on Sep 5, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



No difference -- Those two directives actually invoke the same code in mod_alias when they're parsed.

Simply put, same command, but spelled differently. ;)

Jim

transat99

11:37 pm on Sep 5, 2008 (gmt 0)

10+ Year Member



Marcia ... thanks I was going to look into plugins next.

And Jim -- thanks again!

g1smd

6:40 pm on Sep 6, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Just make sure that you don't mix up rules using Redirect and rules using RewriteRule as you then cannot guarantee the order they will be processed in.