Web Hosting Talk







View Full Version : php -> how to easily have url.php?page=sitename sort of link?


Rui
04-26-2005, 05:21 AM
I wanted to have a mysql (since its for high-traffic sites) that would have a url like:

url.php?page=sitename (where it would go to a outside website i.e http://www.webhostingtalk.com)

I wanted to do this but can't seem to find solutions that don't involve mysql and such :/

Thanks in advance for any possible feedback

Insert_Name_Here
04-26-2005, 06:11 AM
switch($_GET['page'])
{
case "webhostingtalk":
header("Location: http://www.webhostingtalk.com");
exit();
break;
case "google":
header("Location: http://www.google.com");
exit();
break;
}

Do know how to put mysql into this solution but it should do what you want, i think?

Rui
04-26-2005, 06:17 AM
Dammm amazing, you wouldn't belive the unreal amount of coding i've been tru (size wise) and to my suprise the simple small code you posted works wonders.

Thanks alot m8!

cheers

Insert_Name_Here
04-26-2005, 07:56 AM
no probs, but just remember to put in a default case e.g.

switch($_GET['page'])
{
case "webhostingtalk":
header("Location: http://www.webhostingtalk.com");
exit();
break;
case "google":
header("Location: http://www.google.com");
exit();
break;
case default:
echo "this is the default case";
}

Rui
04-26-2005, 07:59 AM
I did ;)

once again thanks alot