repalcing php extensions with directories

Hi folks I been doing research but either I’m not searching for the right thing and or not getting what people are trying to explain.

basically i have an URL as follows

http://www.mysite.com/index.php?page=directory1/page

what I’m trying to do is remove the “index.php?page=” so i get a

http://www.mysite.com/directory1/page

but I’m not too sure how to go about that some places say use .htaccess others suggest php preg replace but truly I’m not sure where to begin

any tutorials or links or help is welcomes

thanks in advance!

This is how Drupal does it; it’s very similar to toneplex’s example, but it doesn’t mess around with extension checking and it adds an extra check on favicon.ico, which many browsers automatically request; this saves an extra hit on your PHP code if you’re missing favicon.ico.

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^ index.php [L]

Make sure you place your .htaccess file on root directory. :wink:

Sponsor our Newsletter | Privacy Policy | Terms of Service