Forum Moderators: mack

Message Too Old, No Replies

Question about redirecting.

Ok, I've seen the meta refresh and the java redirect, and am curious

         

Hearron

1:59 am on Apr 24, 2006 (gmt 0)

10+ Year Member



Ok, I've seen the meta refresh and the java redirect, and am curious which method to use? The site that is now redirecting will become the primary site, I just got the domain name I'd been after and will be switching over the old site, but I'd like the new site to be seen and indexed by the search engines. So which method would work best?

httpwebwitch

3:08 am on Apr 24, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



you should be doing what is called a "301 redirect". This sends an HTTP status to the browser, requesting a redirection to a new URL.

The two methods you describe will send a visitor - using a web browser - from one page to another, but they are not friendly to the search engines. SE robots do not execute javascript. It's deceiving; your browser will redirect, but if a robot arrives on the page, it will not.

learn about HTTP status headers [w3schools.com]

The javascript/META methods you describe say "you have arrived at this page. This is a valid page, and I am sending you content for it. Now, if you understand javascript, I am sending you to another". The client gets the HTTP status "200 - OK"

What you want to say is "you have requested the wrong page. It is no longer supported. Here is the right one, & buh-bye forever". That is done by sending a "301 Moved Permanantly" HTTP status.

That said, there are several ways to intercept a request for page X and send a 301 redirection to page Y.
two are:
1) using a server-side language like ASP, PHP, JSP
2) using an IIS or mod-rewrite rule

In any case, you will be working in some server manipulation techniques, beyond what you can accomplish with Dreamweaver.

you can learn how to do it in several different languages [webconfs.com]

If you are moving an entire site from one domain to another, you will be best served by writing a rule that applies to the entire site. This goes either in an httpd.ini or .htaccess file, where such rules are kept.

in ISAPI rewrite (IIS) or a mod-rewrite (Apache), the rule will look something like this:


RewriteRule (.*) http://www.newdomain.com$1

ignore the hyperlink on that example, the forum does that automatically. I kinda wish it didn't (see TOS)

Many many resources abot this online; you are not the first webmaster in your situation, and for many beginners this is a first step into a greater understanding of what goes on "under the hood".
Good luck;
keep this thread open if you have any trouble

httpwebwitch

3:09 am on Apr 24, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



i forgot to say:
welcome to WebmasterWorld!

Hearron

4:39 am on Apr 24, 2006 (gmt 0)

10+ Year Member



Thank you for warm welcome and quick reply. So I should use a 301 redirect, and this will index the page that is doing the redirecting or the page it redirects to? Or both?

httpwebwitch

2:27 pm on Apr 24, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



it will index the page it is redirecting to.

As a crawler/bot encounters oldsite.com/page.htm, it is redirected to newsite.com/page.htm. If the robot has an index for oldsite, it will be *replaced* by the index for newsite; the oldsite URL will be removed from the index.

301 is a strong message that explicitly says "This is a Permanent change". Once a URL is redirected with 301, it should be retired forever.

TechnoGeek

12:08 am on Apr 26, 2006 (gmt 0)

10+ Year Member



Very good response, httpwebwitch.
I would also advice against using the "meta" style of redirection, as there are some search engines that consider it a proof of spamming, and you risk to have your site banned by using it.
Moreover, it is not good to have two sites with the same content, because content duplication is also penalized by the search engines. It is better to decide which domain seems better, and delete the content from the other one. A 301 redirect is then in order to tell the engines that the content has been moved.
Hope this helps.