This code turns ugly urls full of parameters into user- and search-engine-friendly browser urls. And it’s totally automatic. This is a win-win-situation ![]()
Edit your .htaccess file like this if you want your urls to function like this:
http://domain.com/about -> http://domain.com/about.php
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ $1.php [L,QSA]
# http://domain.com/about -> http://domain.com/about.php
Or, if you want
http://domain.com/about -> http://domain.com/index.php?q=about
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
# http://domain.com/about -> http://domain.com/index.php?q=about