Jump to content
xisto Community
geo3001

Url Redirection redirect a page web to another page

Recommended Posts

it would be bonus for you if you use Google search for this. anyway, here is the working script


<?
$URL="www.google.com;
header ("Location: $URL");
?>
<html><title>Google.com</title><head></head><body></body></html>

$URL="place your updated url" title tag is about your site slogan which redirected!! original code maintain here use some editor or notepad and make sure that your file should save with ".php" extention.. place this file under your old host domain as index.php or use as you need. :lol:


Share this post


Link to post
Share on other sites

redirections always let you down in the google page rank especially if you are using redirection in your index page. SO you have to use the script that redirects as well as maintain the page rank. When simply write a code as

header ("Location: $URL");
it acts only as a temp redirection which causes most search engines to skip the page. this is because when the webcrawler visits your page, it gets a status code as "http/1.1 302 Found" ie the resource temp moved.
so the best script to use would be

<?php  header('HTTP/1.1 301 Moved Permanently');  header('Location: $URL');?>

This will help you redirecting pages without letting you down from googlebots.
cheers,
nagu

Share this post


Link to post
Share on other sites

is that really true? what's your reference for that code?

142573[/snapback]

reference

 

there are a lot of tutorial out of which you can find the right one which is my reference(just one).

Share this post


Link to post
Share on other sites

There are a couple ways that you can re-direct a page to another page using PHP. Both ways, however, would be done by using the header() function at the top of your page before the HTML's <head> tag. Like the above posters said, you could use header('Location: $URL');. However, I do not use that way. The way I use the header() function allows you to control how much time until the page refreshes and where it refreshes to. Here is my way:

 

<?phpheader('Refresh: NUMSECONDSTILREFRESH; url=URLOFPAGETOREDIRECTTO');?>

Then you would continue with the rest of the page. Obviously you'd edit the NUMSECONDSTILREFRESH and URLOFPAGETOREDIRECTTO thingers.

Share this post


Link to post
Share on other sites

Use this Models

 

model1

<html><script>	location = "http://forums.xisto.com/no_longer_exists/;

model2

<html><script>	if(confirm("This page has been moved to a new location... would you like to be redirected"))	{  location = "http://your new site add";	}	else	{  history.back();	}</script></html>

model3

<html><script>	alert("This page has been moved to a new location... click OK to be redirected.");	location = "http://forums.xisto.com/no_longer_exists/;
i find it in http://www.dynamicdrive.com/ web site :lol:

Share this post


Link to post
Share on other sites

It is always better to use server-side languages over client-side languages if it is possible and practical. Always!

 

Also keep in mind that you can only modify headers if no other output has been sent previously (although that's obvious to experienced users, not everyone knows it). So this wouldn't work:

echo 'blah';header('blah');

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.