Web Hosting Talk







View Full Version : google 404


michael-lane
12-26-2005, 01:35 AM
Here is how to redirect your friends to the folder/filename they asked for on google.
<?php
$URL = "http://www.google.com/search?q=".str_replace("/", "", $REQUEST_URI)
header("Location:".$URL);
?>
let me take you through this code. The second line declares the variable $URL as http://www.google.com/search?q= the search engine url then file/folder requested's url without slashes. Then the third line redirects to it in one page load. Of course you can customise this to do other search engines etc. Or to search your own site but theres the bear bones. Go customise.

latheesan
12-31-2005, 10:43 AM
Parse error: parse error, unexpected T_STRING in test.php on line 3

This fixed it:

<?php
$URL = "http://www.google.com/search?q=".str_replace("/", "", $REQUEST_URI);
header("Location: $URL");
?>

Although, it doesnt work on my local server, if go to http://localhost/test.php

it just goes to google search page and looks for test.php