/ Published in: Other

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
I, personally, avoid using extensions like .php in my URLs. For example: http://www.example.com/contact http://www.example.com/contact.php Not only does the first URL look cleaner, but if I decided to switch languages, it would be less of an issue. So how does one implement this? Here is the .htaccess code I found works best: # If requested URL-path plus ".php" exists as a file RewriteCond %{DOCUMENT_ROOT}/$1.php -f # Rewrite to append ".php" to extensionless URL-path RewriteRule ^(([^/]+/)*[^.]+)$ /$1.php [L] Source: http://www.webmasterworld.com/apache/3609508.htm answered Oct 21 '10 at 5:11 community wiki Adam
Comments
