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

Asked

Viewed 99 times

0

I’m looking to remove the . php extension from my web pages.

Created a file . htaccess as below and put 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,is giving page not found. as below:

ERROR 404 - PAGE NOT FOUND

2 answers

1


Change the . htaccess to

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

in the image below see that I finished the http://localhost/test/info (which corresponds to info.php) inserir a descrição da imagem aqui

0

Faça desta forma:

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

  • Thanks for the answer. But it didn’t work .

Browser other questions tagged

You are not signed in. Login or sign up in order to post.