URL: http://spindrop.us/2006/07/26/how-to-remove-file-extensions-from-urls/
You can combine them with this: http://snipplr.com/view/4848/underscore-strings/
.htaccess RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ $1.php [L,QSA] # http://domain/about -> http://domain/about.php -------------------------------------------------- .htaccess RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?q=$1 [L,QSA] # http://domain/about -> http://domain/index.php?q=about <?php // $url_data is an array ?>
Comments
Subscribe to comments
You need to login to post a comment.

For the first example, how would this work for sending variables? Like:
http://domain/about?var=something
Thanks!
I think this is a bit nicer
www.example.com.search.php?q=test to www.example.com.search?q=test
It works with any page too... so index.php, search.php whatever...
RewriteEngine On RewriteCond %{REQUESTFILENAME} !-f RewriteCond %{REQUESTFILENAME} !-d RewriteRule ^(.*)$ $1.php?q=$1 [L,QSA]
Regarding the first rewrite rule: There is a alternative option: If you allow "Options MultiViews" in your Apache Virtual host configuration, Apache does an implicit filename pattern match and chooses from amongst the results - meaning URLs don't need to end in .php.
u need to get segment function to catch any request in URL :)
Thanks mate. I use this on my project and it works perfectly, variables like http://site.com/page?send=this works too.
How
bit nicer thanks