3
I want to block direct access to files that end with the extension .php
.
Suppose I have a page called teste.php
. If the user tries to access it by teste.php
it will receive a 404. The only way for the page to be accessed would be teste
, without the extension .php
.
You could do that with . HTACCESS?
EDIT 1
Folder structure:
.htaccess
index.php
contact.php
error
│ 404.php
│ 500.php
│ ops.php
you don’t think you should redirect it with a simple header("Location") at the top of each page . php?
– Andrei Coelho
I also have this doubt, I find it more convenient to put the 404 error page.
– Israel Sousa
@Andreicoelho It would be better to go to the 404 same.
– hsbpedro
I don’t know much about htacces... so I wonder if it could be in a way and such... well... And what do you think about parsing the url and checking if there is a .php.. extension if it exists, show the 404 page
– Andrei Coelho
It’s perfectly possible, although the best would be 403 which means restricted access. You want to direct all access to index.php?
– Guilherme Nascimento
@Guilhermenascimento may also be for the
index
.– hsbpedro