View Full Version : Prevent listing of a directory
rwgrier
04-14-2003, 09:33 AM
How can I prevent directory contents from being listed if there is not an index.html/index.htm/index.php file in the directory?
Chris
04-14-2003, 10:50 AM
Put the following in your .htaccess file and upload it to your root directory:
Options -Indexes
Simon
04-14-2003, 04:21 PM
I'm sure there's an option somewhere in your CPanel for that. Can't look for it right now.
< Simon >
altatech
04-14-2003, 10:51 PM
CPanel > Index Manager > Select a folder and apply the setting you want ;)
Simon
04-14-2003, 10:53 PM
Yep, that's it. Thanks altatech! :)
< Simon >
I also want to protect a folder and the contents from being viewed. I went into the Cpanel but do not see and Index Manager. Only thing I see that is even close is Pass Protect Folders, but that isn't really what I want to do. Any ideas??
VxJasonxV
04-16-2003, 04:13 PM
It sounds like you're on the vertex theme too, because I don't have Index Manager either.
Altatech/Simon, are you guys on Red/Blue Flash?
Simon
04-16-2003, 06:04 PM
I use "GreySim". From what I could see the "sim's", the "trix's" and "bluelagoon" all have this feature, but I couldn't find it in "vertex".
Perhaps request a change of theme if you're not a reseller.
< Simon >
VxJasonxV
04-16-2003, 06:18 PM
I may just change my theme...
I'm finding more and more things AREN'T in vertex :-\.
I am a reseller though.
What would switching away from vertex matter for resellers?
Simon
04-16-2003, 07:34 PM
If you're a reseller, you can change your theme yourself. Otherwise, you'll have to submit a support ticket asking for a change.
WHM > Modify an Account > [your domain name] > Choose a theme > Save!
Then wait 10-15 seconds and open your CPanel (preferably enter it again from http://yourdomain.com/cpanel/).
< Simon >
Edit: You can change the theme of packages also, so all clients using a particular package are changed at once.
VxJasonxV
04-16-2003, 07:48 PM
Oh, that's what you meant...
I understand now :).
Thanks.
Simon
04-16-2003, 07:57 PM
No worries. I was a little ambiguous.... :)
< Simon >
What is the best cPanel to get?
Simon
04-18-2003, 06:45 AM
From my experience, the "sim" themes seem to be the best mix of features, appearance and ease-of-use. I use "GreySim" because it's fairly professional looking, but there's other colour variations which function exactly the same.
Some themes require you to open sub-menus to find particular options. Most options are available from the main screen on the "sims".
< Simon >
Thanks Simon!
I do like the greysim panel better. I was able to change the indexes for that folder. However I was able to access an include file that houses db connection info by using the full url to that file. Is there a way to prevent people from viewing files like that but allow the permissions to work correctly in the php scripts?
The best thing to do would be to put these files outside of the public_html folder, that way your script can include them using the full path, but they wont be accessable in a browser.
Otherwise put the following at the top of each file you want to stop direct access to:
$mi_script_name="YOURFILE.PHP";
if(substr($PHP_SELF, strlen($PHP_SELF) - strlen($mi_script_name)) == $mi_script_name)
{
echo "Direct Access to " . $mi_script_name . " is not allowed.";
exit;
}
Changing YOURFILE.PHP to what ever the name of the file you are putting the code in.
Putting the file outside the public_html folder would also give you protection should php stop working for any reason, as if this were to happen the browser could return the full source code.
Thanks mort!
I took your advice and moved the entire includes folder outside of the public_html directory.
wcfan3
04-27-2003, 06:38 AM
Did anyone figure out a way to prevent the listing of a directory from Cpanel that is using the Vertex theme, other than just switching themes?
I've got the same problem....my directories are being displayed when you back out the filename from the URL.....:(
VxJasonxV
04-27-2003, 08:04 AM
The past method (still works perfectly) is the second post in this thread.
wcfan3
04-28-2003, 09:42 AM
got the problem fixed....thanks for all the help!! :)
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.