What I want to do is to remove the php file extension needed for the url,
i.e. myipaddress/abc -> myipaddress/abc.php
However I can't seem to get mod_rewrite to work using the solutions in this link.
My .htaccess file contains these lines:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1c.php [L]
So if i have a file named abc.php on my server and my url in the browser is "myipaddress/ab", abc.php will be properly shown. Any file that cannot be found will return me a internal server error (since the third cond is commented out).
In this case i get this to work:
myipaddress/ab -> myipaddress/abc.php
Now if i change the last line like this (which is the answer provided):
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php [L]
Now if I have a file named abc.php and i put in myipaddress/abc, i get a 404 not found which says
Not Found
The requested URL /abc was not found on this server.
If i look up for other links like abcd.php which is not on my server, i still get a 500 internal server error. However when i try a link like myipaddress/name and if name.php is on my server, i get a 404. I'm very confused by the fact that if the url contains name, mod_rewrite will not rewrite the url and have spent hours on it. Can anyone help?