Is there a way a .htaccess file can be written so that
http://www.mysite.com/about
loads about.php
and the same goes for any file?
I tried
RewriteEngine On
RewriteRule ^([0-9A-Za-z]+)$ $1.php
but it doesn't seem to work.
|
This is the most common rule (utilising mod_rewrite -- make sure it is loaded and enabled) -- it will ensure that such .php file does exist before rewriting (yes, it's a bit slower but safer):
Alternatively just use this:
This will turn on "content negotiation". But it has some cons. For example: let's assume you have But if you only have 1 file with such unique name (e.g. |
|||||||||||||
|
^from the beginning of the match expression. – Michael Berkowski Sep 22 '11 at 14:50