...

View Full Version : Help with html url



tan_man999
05-15-2009, 09:31 AM
Hi, what I want to do is to be able to take information from a requested url and use it to display a web page. For example, lets say I enter in the url www.mysite.com/hello.html. even though the file hello.html does not exist on my server, I want a web page to be displayed that uses the word given in the requested url in it. This way I would be able to have a page customized to say anything that is requested. I know this can be done somehow because i see it used all the time. Hope you understand what I am asking. Thanks!

developoor
05-15-2009, 12:26 PM
<?php

echo $_SERVER[REQUEST_URI];

?>

tan_man999
05-21-2009, 09:47 PM
<?php

echo $_SERVER[REQUEST_URI];

?>

Thanks, but when i use this it gives me the slash before the file name i.e. "/hello". is there anyway to not have the slash returned?

Rowsdower!
05-21-2009, 10:11 PM
Give this a shot...


<?php
echo substr($_SERVER['REQUEST_URI'],1] )
?>

hthought
05-21-2009, 10:45 PM
A much better way to do that is using a simple php page. The urls should be like:

index.php?page=home

and then the selection of the file to show is done like:


switch($page)
{
case 'register': break;
default:
$page = 'home';
}

include("$page.php");



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum