Escaping .php extension through the .htaccess file

1

I'm using the following code on a web server, from hostgator, but I can not hide the .php extension. How do I resolve this?

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
    
asked by anonymous 13.01.2016 / 18:10

1 answer

2
RewriteEngine On

RewriteCond %{REQUEST_FILENAME}.php -f
RewriteCond %{REQUEST_URI} !/$
RewriteRule (.*) $1\.php [L]

Of course this will not prevent the user from typing directly into the URL. /arquivo.php

Example usage.

You have a page http://foo.bar/home.php , so you can access as http://foo.bar/home

    
14.01.2016 / 11:24