Reputation: 31
I am using a hosted wordpress site.
I don't like the idea of people accessing my wp-content folder, so I have added in the blank index.php in there.
But I am not satisfied with this solution. To go a step further, is it possible for me to rewrite this index.php such that it does not just show a blank page, I want it to show a 404 page which I already have created. What code should I put in there?
Upvotes: 0
Views: 282
Reputation: 31
Thanks all, in the end this is what I did, I added
Options -Indexes
ErrorDocument 403 /
to my .htaccess file
so when someone tries to access my plugin folder for eg. mysite.com/wp-content/plugins/abc-plugin , my 404 page appears. However when I go to mysite.com/wp-content or mysite.com/wp-content/plugins, a blank page still shows up.
But I guess its better than nothing, because when I first attempted using only
Options -Indexes
in my .htaccess, and I tried to access the plugin folder for eg. mysite.com/wp-content/plugins/abc-plugin , a 403 page with my hosting logo shows up, which I found it unsightly.
Upvotes: 0
Reputation: 771
you could put this in your index.php
<?php
header("HTTP/1.1 404 Not Found");
?>
Upvotes: 1