PDA

View Full Version : 301 Redirect - Help needed



Mia
17th Sep 2009, 06:44 pm
I have 7 pages on the current UF blog that I will need to redirect when I launch the new site.

The pages are still there they have just moved to a new folder.

E.G. I want to Change http://www.urbanfoodie.net/recipes/the-perfect-soft-boiled-egg/ To http://www.urbanfoodie.net/blog/the-perfect-soft-boiled-egg/

N.B. The pages have Wordpress SEF on them

Do I need to:

1 Create recipes/the-perfect-soft-boiled-egg.php and add to header:

<?
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.urbanfoodie.net/blog/the-perfect-soft-boiled-egg/" );
?>

2 Create recipes/the-perfect-soft-boiled-egg/index.php and add to header:

<?
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.urbanfoodie.net/blog/the-perfect-soft-boiled-egg/" );
?>

3 Update the .htaccess file with:

redirect 301 /recipes/the-perfect-soft-boiled-egg/ http://www.urbanfoodie.net/blog/the-perfect-soft-boiled-egg/

As you can see I'm a bit confused by 301 redirect and can't try things out because I haven't moved the site yet.

Help much appreciated!

David
17th Sep 2009, 08:56 pm
The .htaccess file option is the one preferred. I've used it a number of times and search engines make the transition very quickly. Also, the old pages can be removed which is neat.



Redirect 301 /acad/ http://www.cadtutor.net/tutorials/autocad/


I used the above at CADTutor to redirect all requests to the old folder to the new one - worked a treat.

James
17th Sep 2009, 10:29 pm
I agree with David. I have always found .htaccess effective.

Be careful though, sometimes your instructions in the .htaccess file can conflict with search engine friendly URLs, if the SEF URLs are taking instructions from the .htaccess too. I had this problem recently on a CMS site, and had to use the more cumbersome method you describe in (2).

Mia
18th Sep 2009, 10:33 am
Thanks for the advice, really helpful.

I'll try the .htaccess and if it conflicts with the Joomla SEF at least I have 2 as a fallback.

Mia
27th Sep 2009, 12:15 pm
Thanks guys, the .htaccess redirect worked perfectly - Woop!