Kingy Posted September 20, 2008 Share Posted September 20, 2008 Now usually when making a site i'd use the switch() command for navigation to spit out the index.php?page=whatever but for my upcoming website what i'd like to do is just stick with www.domain.com/whatever/ I was wondering if there is some sort of php code that would help will doing this type of navigation or if its just strictly done by using folders. eg: inside the public_html folder have a file called index.php and another folder called members. Inside the members folder have another index.php and from the first index.php just link to <a href="/members/">Members</a> that way it would just open the members index.php. But i'm thinking this would involve a lot of editing if u wanted each index.php to look the same. Change one you gotta change em all. Cheers. Hopefully i explained myself all good Link to comment https://forums.phpfreaks.com/topic/125053-php-navigation/ Share on other sites More sharing options...
JasonLewis Posted September 20, 2008 Share Posted September 20, 2008 Look around for mod_rewrite tutorials, for some things it can be complicated, but for simple things it can be quite easy. Link to comment https://forums.phpfreaks.com/topic/125053-php-navigation/#findComment-646424 Share on other sites More sharing options...
barrylee Posted September 20, 2008 Share Posted September 20, 2008 Here's what I do RewriteEngine on RewriteRule ^([a-z\-]+)$ ../../../../../../../index.php?Function=GetPage&name=$1 load that to your root and call it .htaccess in this example I pass the link name into the url, this gets passed into $1, index.php then uses $1 in a query to get the results, ie. select * from pages where link = $1 boom there you have it. Just modify this as you need to, you may need to go up or down a level, and your server will have to support this. Link to comment https://forums.phpfreaks.com/topic/125053-php-navigation/#findComment-646462 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.