How to deny access to specific pages with htaccess
问题 How can I send a 404 page error for specific pages that exist on the web server? (Using htaccess). For example, I have a config.php file and when I go to localhost/config.php it just shows a blank white page with nothing in it. I want it to appear as a 404 page, like the page doesn't exist. How can I do that? Thanks! 回答1: If you specifically want to return a 404 Not Found then you can use mod_rewrite, near the top of your .htaccess file: RewriteEngine On RewriteRule ^config\.php$ - [R=404,L]