301 redirect question

Matt

TPer Emeritus
Suspended / Banned
Messages
22,999
Name
matt
Edit My Images
Yes
Anyone know what the correct code is to redirect any page from an old site to a new index page on a new domain? I know this isnt the best way to do t for search engines, but way too many pages to do it any other way i think, unless anyone knows how to do that?
 
Hi Matty

Place this between the <HEAD> and </HEAD> tags

<meta HTTP-EQUIV="REFRESH" content="3; url=http://www.yourdomain.com/index.html">

Change the http to your own

Change the content number to the lenght of time in seconds you want visitors to wait on the holding page before being redirect, set to 0 if you want a straight no wait redirect
 
Last edited:
Gary Coyle said:
Hi Matty

Place this between the <HEAD> and </HEAD> tags

<meta HTTP-EQUIV="REFRESH" content="3; url=http://www.yourdomain.com/index.html">

Change the http to your own

Change the content number to the lenght of time in seconds you want visitors to wait on the holding page before being redirect, set to 0 if you want a straight no wait redirect

Thanks Gary, I'll give that a try
 
If you can set up a DNS redirect with your host, it'd be cleaner! :)
 
Anyone know what the correct code is to redirect any page from an old site to a new index page on a new domain? I know this isnt the best way to do t for search engines, but way too many pages to do it any other way i think, unless anyone knows how to do that?

Using Meta refresh is nowadays frowned on by Google who recommend the 301 re-direct:

http://www.google.com/support/webmasters/bin/answer.py?answer=93633&&hl=en

Too many meta refreshes (especially "nested" meta refreshes) can get those particular pages dropped from its index.

Failing that you could use a Javascript redirect:

<script type="text/javascript">
location.replace('http://www.example.com/');
</script>

This should be placed between the <head> and </head> tags:

http://andylangton.co.uk/articles/javascript/javascript-redirect-scripts/

.
 
Last edited:
or use .htaccess to send back the 301 without having to change each page.

Be aware that redirects throw away POSTed data.


As demilion suggests, can you not set the A record in DNS for the old site to point to the new server and configure apache on the new server to serve the same pages for both domains?
 
Matty you definately need to use an .htaccess file to do this as search engines will pass your page rank to your new domain/ page as search engines don't like javascript directs.

Create a blank file in notepad, add the line below and save as (make sure you choose 'save as type: All Files') and save this as .htaccess. Place this file in the root of your domain. You can add as many redirects to this as you want

redirect 301 myoldwebisteorpage.com/file.html mynewwebisteorpage.com/file.html
 
Back
Top