View Full Version : Redirect script?
scorpius
15-10-2003, 20:48
hi, i've used this script before. but i cant find it. don't know how to write it either. its written in php, the code was only a line long, i think there's "$url" inside too. can someone tell me? its a redirect script btw, that means when someone visited the page, it'll redirect to another page.
This is the simplest redirect script I know:
<?
header("Location: http://www.domain.com/page.html");
?>
It does not include $url though. Just sharing...hope you don't mind :)
scorpius
15-10-2003, 21:18
ohhh....thanks. does it affect whether googlebot will visit the site?
It shouldn't really affect although googlebot would just index that page and any other related pages with reference to that page :)
scorpius
15-10-2003, 21:54
thanks :)
No problem. If you do remember how to write the other one-line PHP script with $url in it, please do inform me. I would like to see how it works :)
scorpius
15-10-2003, 22:12
Ok sure, Btw, you've hit 1000 posts! Congrats.
Originally posted by userguy
It shouldn't really affect although googlebot would just index that page and any other related pages with reference to that page :)
I've used this (PHP version) on one of my sites and I'm sure it doesn't affect Googlebot. googlebot found the redirected site and put it on its list although there's no link to the site from anywhere on the WWW.
Always look at the generated html codes instead of PHP code itself, coz googlebot wont be able to see what is your PHP.
Originally posted by fred
Always look at the generated html codes instead of PHP code itself, coz googlebot wont be able to see what is your PHP.
So, do you mean that if there is only PHP in your site redirect's source code, Googlebot would not be able to locate the redirected link and thus, you must include some html code?
Use this to make Google follow the redirect and index the site:
-----
<?php
header('HTTP/1.1 301 Moved Permanently');
header('Location: http://www.yoursite.com/newlocation/');
?>
-----
remember to change yoursite.com to your site name & newlocation to your new site location.
Heard that it's faster & less resource intensive to set up an .htaccess file as there is no need to parse any code. -> Don't ask me how as I have not tried out.
Originally posted by qwerty
Use this to make Google follow the redirect and index the site:
-----
<?php
header('HTTP/1.1 301 Moved Permanently');
header('Location: http://www.yoursite.com/newlocation/');
?>
-----
remember to change yoursite.com to your site name & newlocation to your new site location.
Heard that it's faster & less resource intensive to set up an .htaccess file as there is no need to parse any code. -> Don't ask me how as I have not tried out.
Ok. Thanks :) Anyone with indexed by Google can verify that Googlebot is able to follow the redirect faster and use less resources?
CrazyHost
22-10-2003, 01:28
Do you mean this?
<META HTTP-EQUIV="Refresh" CONTENT="0;URL=http://www.yourdomain.com">
CrazyHost
22-10-2003, 01:28
Do you mean this?
<META HTTP-EQUIV="Refresh" CONTENT="0;URL=http://www.yourdomain.com">
Opps, ignore this 2nd post. Sorry, did not mean to post 2 of the same messages due to my some errors.
Thats called a META Refresh.
If you prefer using .htaccess. Replace the old-url & new-url with your own..
Redirect old-url new-url
Search engines can follow both .htaccess and server-side scripting redirects as I have tried both before.
Originally posted by alien
If you prefer using .htaccess. Replace the old-url & new-url with your own..
Redirect old-url new-url
Search engines can follow both .htaccess and server-side scripting redirects as I have tried both before.
Ok. Thanks for the information and verification :)
vBulletin® v3.5.6, Copyright ©2000-2010, Jelsoft Enterprises Ltd.