Webmaster Forum


Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
LinkBack Thread Tools Display Modes
Share |
  #1 (permalink)  
Old 01-05-2010, 12:02 PM
Contributing Member
Latest Blog:
None

 
Join Date: 09-30-09
Posts: 57
iTrader: 0 / 0%
Help: How to Prevent Access to Directory?

I have a wordpress blog and am trying to figure out how to prevent visitors from accessing my files that are located in the directory. Here is an example

I have an image located at:

"http://www.example.com/wp-content/uploads/2009/12/image.jpg"

And if I were to type in this URL in my browser, visitors gain access to all my files that were uploaded on December 2009:


"http://www.example.com/wp-content/uploads/2009/12"

Also, if I were to type in this URL in my browser, visitors gain access to all my files that were uploaded in 2009.


"http://www.example.com/wp-content/uploads/2009"

Is there a way to prevent this? I added a code to my htaccess file and it disallowed anyone access to these files, HOWEVER, it took my entire website down as well.

The second thing I tried was going into my FTP (Filezilla) and changing the File Permissions for the appropriate folder (wp-content) so that Visitors could just "Read" and NOT "Execute" or "Write". After doing this, visitors cannot access the files and the website is still live, BUT all the images on the website do not show, but the site is still up.

Help would be greatly appreciated. It's been very frustrating.
 
Reply With Quote
  #2 (permalink)  
Old 01-05-2010, 12:37 PM
HTMLBasicTutor's Avatar
Super Moderator
 
Join Date: 10-29-07
Location: British Columbia, Canada
Posts: 18,105
iTrader: 5 / 100%
.htaccess file in folder where you don't want them to see the list of folder contents with:
Code:
Options All -Indexes
Gives the following message:
Quote:
Error 403 - Forbidden
You tried to access a document for which you don't have privileges.
__________________

HTML Basic Tutor - Learn how to code for better SEO
Basic Computer Information - Computer & internet basics for website owners

SEO troubleshooting and review services available. - Pm me.
 
Reply With Quote
  #3 (permalink)  
Old 01-05-2010, 01:08 PM
Mia's Avatar
Mia Mia is offline
v7n Mentor
 
Join Date: 04-28-06
Location: Lake Geneva, WI.
Posts: 522
iTrader: 0 / 0%
Some simple solutions which does not lock people out but will accomplish the same easily.

Just place an index file in each directory that redirects to the index of the site itself.
Also, to insure the SE's do not index be sure to place a robots.txt file with the following in it:

Disallow: /images
__________________
Jeremy Anthony Kinsey
Bella Mia, Inc.HostDrive.Com
Get Go To Meeting & Go To PC FREE
 
Reply With Quote
  #4 (permalink)  
Old 02-02-2010, 12:44 AM
Contributing Member
Latest Blog:
None

 
Join Date: 09-30-09
Posts: 57
iTrader: 0 / 0%
Quote:
Originally Posted by htmlbasictutor View Post
.htaccess file in folder where you don't want them to see the list of folder contents with:
Code:
Options All -Indexes
Gives the following message:
I tried the Options All -Indexes and it worked for 3 days with no issues, and then all of a sudden out of nowhere, the images on my blog stopped appearing. And then I removed the code from the .htaccess file and the images appeared on my blog again. As of right now, I have removed the code. Why is this the case?
 
Reply With Quote
  #5 (permalink)  
Old 02-02-2010, 09:46 PM
HTMLBasicTutor's Avatar
Super Moderator
 
Join Date: 10-29-07
Location: British Columbia, Canada
Posts: 18,105
iTrader: 5 / 100%
Not sure why it's a problem all of a sudden unless your hosting did something.

Try the blank index page in the folder(s) idea. That will stop people seeing a list of the images in the folcer, although a pain that you have to do this each time you make a new folder.
__________________

HTML Basic Tutor - Learn how to code for better SEO
Basic Computer Information - Computer & internet basics for website owners

SEO troubleshooting and review services available. - Pm me.
 
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

Reply

Tags
blog, htaccess, wordpress


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
NDA. How to prevent violation? ernest1a Internet Legal Issues 3 01-17-2009 02:03 AM
How can you prevent this? Looker1 Web Directory Issues 3 09-04-2007 09:40 AM
PHP - How to prevent comment SPAM? ATLien Coding Forum 6 01-02-2007 12:43 PM
Prevent Indexing SN3 Google Forum 9 03-04-2005 01:41 PM
How to prevent yourself from the Blaster Worm and how to.... ali Marketing Forum 10 02-24-2004 10:50 AM


V7N Network
Get exposure! V7N I Love Photography V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 11:28 PM.
Powered by vBulletin
Copyright © 2000-2013 Jelsoft Enterprises Limited.
Copyright © 2003 - 2013 Escalate Media LP




Search Engine Optimization by vBSEO 3.6.0 RC 2 ©2011, Crawlability, Inc.