: Restrict access of rewriting file using .htaccess I rewrite my .php files to .htm, using the following code in .htaccess file. RewriteEngine on Options +FollowSymlinks RewriteRule ^(.+).htm$ .php
I rewrite my .php files to .htm, using the following code in .htaccess file.
RewriteEngine on
Options +FollowSymlinks
RewriteRule ^(.+).htm$ .php [NC]
This is working fine. But now I want to restrict access of .php file directly.
As example: when people request index.htm he can see the content of index.php file, but if he request index.php then he will get an 404 error. How is it possible?
More posts by @Alves908
1 Comments
Sorted by latest first Latest Oldest Best
RewriteRule .*.php /404.htm
That's untested but basically I would redirect *.php to 404.htm and then create a 404.php to cater for that. Put this rule above your .htm to .php rule.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.