Warm tip: This article is reproduced from stackoverflow.com, please click

Showing 404 error while someone tries to access .php files?

发布于 2020-03-29 21:02:07

How to stop php from executing .php files while being accessed directly. I want to do routing on files and also want to stop users from directly accessing the .php files. Is there anyway to change the .htaccess file to achieve the functionality.

Jawad Nasar Shah
Samir Lakhani 2020-01-31 18:59

Prevent direct access to php files

write code in .htacess file.

<Directory "^public_html">
<Files "^(*.php|*.phps)">
    order deny,allow
    deny from all


<Files *.php>
deny from all