geo3001 0 Report post Posted May 18, 2005 HiIs there some functions in php to redirect a page web to another page.thanks Share this post Link to post Share on other sites
badinfluence 0 Report post Posted May 18, 2005 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. Share this post Link to post Share on other sites
nagu 0 Report post Posted May 18, 2005 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
karlo 0 Report post Posted May 18, 2005 is that really true? what's your reference for that code? Share this post Link to post Share on other sites
nagu 0 Report post Posted May 18, 2005 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
Mike 0 Report post Posted May 19, 2005 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
alexia 0 Report post Posted May 21, 2005 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 Share this post Link to post Share on other sites
Spectre 0 Report post Posted May 24, 2005 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