: How to set up a 403 forbidden I've recently set up my first commercial website for someone, with godaddy hosting. I want to set up a 403 forbidden on several directories (and their contents)
I've recently set up my first commercial website for someone, with godaddy hosting.
I want to set up a 403 forbidden on several directories (and their contents) that are referenced to through php only (e.g. /includes, /txt).
How can I set this up firstly so it's forbidden, and secondly, so it redirects to a custom page?
Also on godaddy I can't seem to get to the root of my server, it simply takes me to the 'html' folder, but I believe the .htaccess file is located at a higher-level directory. How can I access this?
More posts by @Hamaas447
1 Comments
Sorted by latest first Latest Oldest Best
Create an .htaccess file in the directory you wish to block, or your root HTML directory if you want this to affect your entire website. Place this code inside:
# Block includes if they have a .inc.php extension. Change
# that to match whatever extension you use for your includes.
<Files *.inc.php>
Order Deny,Allow
Deny from All
</Files>
# Block access to .txt files
<Files *.txt>
Order Deny,Allow
Deny from All
</Files>
# Create a custom page for all 403 errors
ErrorDocument 403 /misc/403.php
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.