how properly can I hide .php extensions form my url : example:
www.example.com/index.php
to
www.example.com/index
My .htaccess file content is:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
And it is not working although phpinfo() shows that mod_rewrite is in “Loaded Modules” section. What’s wrong here?
When I tried to set Authentication:
AuthUserFile /usr/home/vesa/.htpasswd
AuthGroupFile /dev/null
AuthName Somewhere Neat
AuthType Basic
<Limit GET POST>
require user vesa
</Limit>
enter code here
It asked for username and password. Therefore I assume that .htaccess files are processed by server. Right?
When I try to add
Options +FollowSymlinks
I get 500 Internal Server Error
When I add RewriteRule (.*)\.asp $1.php it successfully changes any .asp extension to .php
When I use RewriteRule it just redirects my browser to another file. So in case if I will try to hide extension it should redirect me to file with no extension – in which case I will get error because there is no such file exists. What is the simplest way to make mod_rewrite “hide” (write url filenames without extension .php) while linking to .php files?
Probably, there is some configuration set that allows (for .htaccess file) to redirect to any file, it is basically rewrite URL, but in the same time it is not allowing
Options +FollowSymlinks. I’m not familiar with php config file, but i am sure system administrators knows what is going on.