Forum Moderators: coopster
I have a site where the database is not connected to PHP.
I would like to know a command where the URL typed matches what is then displayed on the page.
Ie url is www.mysite.co.uk/great-stuff
or url is www.mysite.co.uk/not-so-good
I would then like this to be show on the page (where I choose)
For example
my subject is great stuff as usual.
or my subject is not so good as usual.
Can I do this without a database. (something else I would have to learn)
Or can it be done without.
Thanks
Mark
page.php
<?php
if([url=http://us3.php.net/manual/en/function.isset.php]isset[/url]($_GET['subject'])) {
echo 'My subject is '.$_GET['subject'].' as usual!';
}
?>
Now type this into the url for this page:
http://your_site.com/page.php?subject=stuff
This example uses the $_GET Superglobal [us3.php.net].
Also, for more PHP learning sources visit this thread on Learning PHP - Books, Tutorials and Online Resources [webmasterworld.com] from our Library [webmasterworld.com].
Good luck!
Somthing like:
RewriteEngine on
RewriteRule ^/subject/(.*)$ /page.php?subject=%1 [L]
Andrew
You should use $ instead of % in the RewriteRule:
Like this:
RewriteEngine on
RewriteRule ^subject/(.*)$ /page.php?subject=$1 [L]
If you want to keep the url in the address bar replace the L with: nc
More information here: [webmasterworld.com...]
[edited by: Psychopsia at 2:16 am (utc) on Oct. 12, 2006]