View Full Version : How do I Deny Access for Certain Directory?
Mostjolly
08-21-2010, 12:04 PM
For example I wanted to deny all access to my /downloads area.
So say when a person enter: www.samplesite/downloads they be redirect back to the mainpage or hidden so they wouldn't even know it's existed.
Please do not advise to put on a password access page as I want to keep this directory hidden/non-existed from all members and guests.
I pretty sure this can be done.. maybe a little tweak in httaccess.. anyways please provided the codes or easy direction on to accomplish this.
Thanks all.
BirdOPrey5
08-21-2010, 08:00 PM
You could set up a redirect in htaccess but no one would be able to access the directory including you... if that is the case it's better you don't even have the directory to begin with or if it's for backup files or such just move it 1 level above your public_html directory so it isn't accessibly by http at all.
Mostjolly
08-21-2010, 11:01 PM
Thanks BOP5,
I'm interest in the htaccess redirection, please provided the codes to be used :)
BirdOPrey5
08-22-2010, 12:00 AM
I believe your .htaccess file should look like this:
RewriteEngine on
Redirect 301 /downloads/ http://www.example.com/somewhere_else/
Where 'downloads' is the directory you want to 'hide' and 'somewhere_else' is any other directory on your site.
Mostjolly
08-22-2010, 11:15 AM
I believe your .htaccess file should look like this:
RewriteEngine on
Redirect 301 /downloads/ http://www.example.com/somewhere_else/
Where 'downloads' is the directory you want to 'hide' and 'somewhere_else' is any other directory on your site.
It actually works.. I love you :)
An extra question.. I'd also like to know how to redirect for certain .php page, for example when someone type: www.yoursites.com/arcade.php ~~> I'd like it to redirect back to the hompage.
BirdOPrey5
08-22-2010, 12:30 PM
Assuming you already have the line "RewriteEngine on" from the above, add this line:
redirect 301 /arcade.php http://www.example.com/index.php
Mostjolly
08-22-2010, 02:19 PM
Assuming you already have the line "RewriteEngine on" from the above, add this line:
redirect 301 /arcade.php http://www.example.com/index.php
Works like miracle.. I can't thank you enough!
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.