Hiding directory contents


#1

my previous host had a feature that would automatically hide the directory contents from public view for any directory that did not have an index page. This was separate from having a directory password protected.

so if I had mydomain.com/images/filename.jpg and that “images” directory did not have an index file, no one would be able to see all contents of the directory “images” by truncating the path name in a browser window. if they attempted to go to “mydomain.com/images/” in a browser they’d get an error.

I found this to be a great privacy feature, particularly with client work. It was simple to set up: just clicking a checkbox and the whole site was given this feature.

How do I do this with my dreamhost account?


#2

You can create a .htaccess in the directory. And Options -Indexes will disable directory index.
http://wiki.dreamhost.com/Htaccess
http://wiki.dreamhost.com/Modifying_directory_indexes

You may not be able to create .htaccess file in window environment. But you can always log in via SSH and create one using touch .htaccess

Make sure you are in the right folder. :stuck_out_tongue:

$50 off and 3 free domains with code: [color=#CC0000]DH3[/color] Sign Up NOW or More Codes Here


#3

thank you for the links. :slight_smile:
I had searched the wiki countless times for varying phrases like “blind index”, “hide directory”, “protect directory” and all combinations of them, but couldn’t find anything.

I created the .htaccess file containing only “Options -Indexes” and it worked perfectly.

In case anyone else needs to do this, I just accessed my server via the WebFTP option and created the file via that interface:
Manage Domains > domain name, click WebFTP
enter FTP password
click New File button at the top
enter content and file name, click disk icon to save

very easy solution.

Thanks!


#4

[quote]In case anyone else needs to do this, I just accessed my server via the WebFTP option and created the file via that interface:
Manage Domains > domain name, click WebFTP
enter FTP password
click New File button at the top
enter content and file name, click disk icon to save[/quote]
I’m really glad you got your problem solved, and that the process you described above worked well for you, but a warning is in order!

It is not a good idea to edit source files on the server using the WebFTP program (and the wiki even warns of this in a couple of places). You can get away with it for a simple .htaccess file creation or modification, but if you do that with a perl script, you will have nothing but grief.

This is because the WebFTP program does not generate proper *nix style line endings, and that will break many scripts! :wink:

–rlparker


#5

thanks for the warning. :slight_smile: I’ll only use that method for simple .htaccess needs. I’m on a Mac and in the past have found that creating .htaccess/.htpassword files doesn’t work well on a mac. Something about the way Macs save files (adding or not adding something important). Causing password issues in the past. Whereas when I did the same exact thing on a PC I had no problems. just figured I’d go through the web interface for simplicity and to avoid the issue so I didn’t have to keep jumping between machines, logging on at both, etc… :slight_smile:


#6

I’m glad it works for you.

FYI, you can use DH’s panel to create simple htaccess to protect your directory too. Check DH panel --> Goodies --> Htaccess/WebDAV

$50 off and 3 free domains with code: [color=#CC0000]DH3[/color] Sign Up NOW or More Codes Here