Remove .php extension from pages, however ERROR 404 - PAGE NOT FOUND appears

0

I'm trying to remove the .php extension from my web pages.

I created a .htaccess file as below and put it in the root directory

DirectoryIndex index.php
RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}\.php -f 
RewriteRule ^(.*)$ $1.php

When I try to access the page by taking the extension, it is giving page not found. as below:

ERROR 404 - PAGE NOT FOUND
    
asked by anonymous 23.09.2018 / 07:21

2 answers

1

Change .htaccess to

RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^(.*)$ $1.php

In the image below, see the link (which corresponds to info.php)

    
24.10.2018 / 18:16
0

Faça desta forma:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
    
23.09.2018 / 19:44