301 redirect question

Status
Not open for further replies.

JamesA

Member
I’m moving my site from irishwidget.com to widget.ie

I’m using this

Code:
<? 
Header( "HTTP/1.1 301 Moved Permanently" ); 
Header( "Location: [URL]http://www.widget.ie/test.htm[/URL]" ); 
?>

If I put the code into my header and it appears on (irishwidget.com/test.htm) should it be able to locate the same page (widget.ie/test.htm) on the new domain.
It just seems to redirect to widget.ie

Will it hurt if all the pages on irishwidget.com redirect to the homepage of widget.ie? Is this the best way to move to a new domain and retain my google trafic?

Any help appreciated.
 

RedCardinal

New Member
I’m moving my site from irishwidget.com to widget.ie

I’m using this

Code:
<? 
Header( "HTTP/1.1 301 Moved Permanently" ); 
Header( "Location: [URL]http://www.widget.ie/test.htm[/URL]" ); 
?>
If I put the code into my header and it appears on (irishwidget.com/test.htm) should it be able to locate the same page (widget.ie/test.htm) on the new domain.
It just seems to redirect to widget.ie

Will it hurt if all the pages on irishwidget.com redirect to the homepage of widget.ie? Is this the best way to move to a new domain and retain my google trafic?

Any help appreciated.
Best way is probably to redirect oldPageA -> newPageA, oldPageB -> newPageB using .htaccess in link above from Michele.

If your site is very large (hundreds or thousands of pages) then it is bext to do this in chunks so as not to confuse the spiders.
 

RedCardinal

New Member
With my method you can do one page or a million pages at once :)
Sorry, didn't read it. Just assumed it was for .htaccess.

Will read now though...

Oh, BTW, you dont ever want to redirect millions of pages at once. Google have stated that the spider will choke and it's likely to harm your rankings.
 

mneylon

Administrator
Staff member
You could put it in a .htaccess, but it seems to be more graceful to have two vhosts anyway

Vhost1 - your original domain with mod_rewrite settings in either .htaccess or directly within apache

Vhost2 - your target site ie. where you want it all to end up

As for choking spiders.. I can't see why that would happen unless you were doing really complex redirects ie. mapping multiple paths to multiple destinations
 

RedCardinal

New Member
As for choking spiders.. I can't see why that would happen unless you were doing really complex redirects ie. mapping multiple paths to multiple destinations
'choke' might have been the wrong phrase. The spider has no problems with the content, but how the index is created and redirects are processed may be affected by redirecting large quantities of pages in one go.

In essence the spider will eat it up but the index will spit it out.
 

JamesA

Member
Thanks for all the help guys, I'll probably be back for more when I get around to putting this redirect into practice. At least I know where to start now.

ps: I asked the same question over at webmasterworld without much success. Thanks for putting this place together and being so helpful.
 

JamesA

Member
Thanks guys I've gotten this to work
Code:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} irishwidget.com$
RewriteRule ^(.+) [URL]http://www.widget.ie/$1[/URL] [L,R=301]
But during the transfer I've had to move a folder called "ia" into the cgi-bin, so that, pages that were at irishwidget.com/ia/ are now at widget.ie/cgi-bin/ia/
Is there any thing I can add to get these pages to redirect properly?
 

louie

New Member
best option is like this:
Code:
RewriteCond %{HTTP_HOST} ^(www\.)?irishwidget\.com #just in case www is missing from url
RewriteRule ^(.+)  [URL]http://www.widget.ie/$1[/URL] [L,R=301]
 

daviddoran

New Member
Just in reference to James' question about the ia folder:
Code:
RewriteCond %{HTTP_HOST} ^(www\.)?irishwidget\.com #just in case www is missing from url
RewriteRule ^ia/$  http://www.widget.ie/cgi-bin/ia/ [L,R=301]
RewriteRule ^(.+)  http://www.widget.ie/$1 [L,R=301]
 

JamesA

Member
Thanks David, but I'm still having a problem :eek:
This is what I'm using

Code:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^(www\.)?harmonicajukebox\.com
RewriteRule ^ia/$  http://www.harmonicaclub.com/cgi-bin/ia/ [L,R=301]
RewriteRule ^(.+)  http://www.harmonicaclub.com/$1 [L,R=301]
The redirect is working for harmonicajukebox.com although it does bring it to harmonicaclub.com/index.html (don't know if that matters) and it works for all folders that are in the same structure as the original site.
When it tries to direct http://www.harmonicajukebox.com/ia/test.htm to http://www.harmonicaclub.com/cgi-bin/ia/test.htm I just get a 404 error
 
Status
Not open for further replies.
Top