WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Hiding directories with .htaccess file (9 posts)

  1. initialsbr
    Member
    Posted 4 years ago #

    I am starting a small record label and using the WP E-Commerce plugin to provide digital downloads for customers. I want to hide the directory we use to provide free mp3 downloads and I want to hide the uploads directory. I found this post but I don't know anything about htaccess:

    http://wordpress.org/support/topic/226431?replies=6

    I tried to create a file with only this code:

    Options -Indexes

    named ".htaccess" and it said that file names starting with a "." are reserved for the system.

    What do I do to make this work? Is there any other markup in the file I need to write, like in an html file? Am I correct reading that I need to upload it with ASCII and set the chmod to 644?

    Thanks!

  2. dsmith21212
    Blocked
    Posted 4 years ago #

    Hi initialsbr,

    Download NoteTab. It will allow you to create and save .htaccess files.

    http://www.notetab.com/downloads.php

  3. initialsbr
    Member
    Posted 4 years ago #

    I don't really want to add another program to make this file. I run OSX anyway, so that software would require even more software to even run it.

    The only solution I've found is to save it as something else like _htaccess, upload it, and then change the name through my FTP client. Is that an okay option?

    Also, I still have questions about the coding. Is this really all I have to write in the file for it to work how I want it to?

    Options -Indexes

    Thanks!

  4. ClaytonJames
    Member
    Posted 4 years ago #

    The only solution I've found is to save it as something else like _htaccess, upload it, and then change the name through my FTP client. Is that an okay option?

    That should be fine. In fact it's probably the best solution. Just create it as a text file and then upload it to the server. Change it to the .htaccess extension and you should be good to go. OS X just didn't like it because on 'Nix based systems the "." indicates a hidden or system related file.

    Is this really all I have to write in the file for it to work how I want it to?

    That should be it. Right at the top of the file:

    Options -Indexes
    #BEGIN WordPress
    </IfModule mod_rewrite...

    That should prevent casual browsing of directories that do not contain an index file.

  5. ClaytonJames
    Member
    Posted 4 years ago #

    Is there any other markup in the file I need to write, like in an html file? Am I correct reading that I need to upload it with ASCII and set the chmod to 644

    You may want to create the file, chmod it to 666, then let wordpress update your permalinks, then verify that the Options -Indexes is at the top of the file. Then chmod the file back to 644 when done.

  6. initialsbr
    Member
    Posted 4 years ago #

    Thanks a lot. So am I just adding this to an .htaccess file that is already in there or am I creating a whole new file and putting it in the uploads folder? I was trying to do the latter, but your description makes me think I should do the former.

  7. ClaytonJames
    Member
    Posted 4 years ago #

    There should only be one .htaccess file. Place it in the same directory you installed wordpress in. If it's already there, you can work with that one. Don't put it in the uploads folder.

    Creating and editing (.htaccess)

    ..also on that same page, see Automatically updating .htaccess

    I usually create a blank .htaccess file, chmod to 666, update my permalinks to my preferred structure, then add the "Options -Indexes" and chmod back to 644. Seems to work okay for me.

  8. initialsbr
    Member
    Posted 4 years ago #

    Thanks so much. That's great.

  9. ClaytonJames
    Member
    Posted 4 years ago #

    You're welcome.

Topic Closed

This topic has been closed to new replies.

About this Topic