Click to See Complete Forum and Search --> : Include URL php.
pixel-artist-2
03-03-2005, 02:36 PM
So I have a the my site and I want to make it so its like this
www.mysite.com/index.php?pagename here
and then if its a page it'll show it in using the include code. and not or isn't there go to homepage...
NogDog
03-03-2005, 02:59 PM
It would be easier I think to use www.mysite.com/index.php?page=pagename , then your PHP code would:
<?php
# see if pagename was sent:
if(isset($_GET['page']))
{
# see if pagename is valid
if(file_exists("path/to/files/{$_GET['page']}"))
{
# redirect to that page
header("Location: http://www.mysite.com/path/to/files/{$_GET['page']}");
exit; # we're outta here
}
}
?>
<html>
<!-- default page goes here -->
</html>
pixel-artist-2
03-03-2005, 03:24 PM
Originally posted by NogDog
It would be easier I think to use www.mysite.com/index.php?page=pagename , then your PHP code would:
[/php]
I'm not sure if that is what I want. I'm going to have index.php then link will go to www.myhost.com/index.php?name=whatever and I'll have <?php include('[here will be the name].php'); ?>
pixel-artist-2
03-03-2005, 08:21 PM
I'll try to rephrase it.
Have a include function where it put in the www.site.com/index.php?page=page
and if the page doesn't exist or the isset is there it goes to homepage...