Welcome to WebmasterWorld Guest from 18.104.22.168 , register , free tools , login , search , pro membership , help , library , announcements , recent posts , open posts Become a Pro Member
take keywords from url, use them on page invisible777 msg:3385660 1:28 am on Jul 4, 2007 (gmt 0) how can i do the following...
user types in my www.mydomain.com/anywordhere
how can i echo the 'anywordhere' onto the page?
coopster msg:3385687 2:16 am on Jul 4, 2007 (gmt 0)
Welcome to WebmasterWorld, invisible777.
You should be able to parse out the pieces you need from one of PHP's
$_SERVER [ php.net]superglobal variables. invisible777 msg:3385711 2:43 am on Jul 4, 2007 (gmt 0)
Hi, thanks for the reply. I have this piece of code:
$keys = explode("-",str_replace(array("http://",".php"),"",$_SERVER['SCRIPT_URI'])); echo $keys."<br>".$keys;?>
which requires the page exist... whereas i just need something that allows the user to type in www.mydomain.com/absolutelyanythinghere and then i suppose to be redirected to an index.php where 'absolutelyanythinghere' can be echoed onto the page...
Mohamed msg:3386091 1:46 pm on Jul 4, 2007 (gmt 0)
you can pass that string to index.php as parameter
and then in index.php
use get to get paremeter
$string = $_GET['invalidpage'];
then display value of the variable
echo $string; invisible777 msg:3386161 3:39 pm on Jul 4, 2007 (gmt 0)
sorry im not following... how does that redirect occur if the original invalid page does not exist? milanmk msg:3386313 7:02 pm on Jul 4, 2007 (gmt 0)
You need to add the following code to your .htaccess file.
RewriteRule ^([^/]+)$ /index.php?invalidpage=$1 [L]
And your index.php will be