Mikor -
Joined: 21 Aug 2006 Posts: 144 Location: Hull, England
|
Posted: Mon Aug 21, 2006 12:27 am Post subject: Short URL's |
|
|
This script will make all your URL's into http://www.your-web-site.com/index.php?act=page_name
Just save this as index.php and put it in your htdocs folder.
Code: |
/*
* To add a URL, put in this list: 'short name::relative path'
* Where 'short name' is the thing in the url (ie: index.php?act=page
* 'relative path' can include directories (ie: pages/mypage.html)
* Make sure you put a comma between each entry in the list.
*/
$URLs = array('page1::page1.php','page2::page2.php'); //Put your pages here.
//Dont touch any of the below code.
$invalid = true;
$path = '';
foreach($URLs as $item){
if($invalid == true){
$exploded = explode('::',$item);
if($_GET['act'] == $exploded[0]){
$invalid = false;
$path = $exploded[1];
}
}
}
if($invalid == true){
die('Invalid URL.');
}else{
include $path;
} |
To link to a page, make a link to "index.php?act=page" where 'page' is the value you entered before the '::' in the list.
-----
Reply if you have any problems. I'm tired as i'm writing this, so it may be buggy. |
|