Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

How to allow access to a specific sub-folder in .htaccess

Posted on 2010-11-23
6
643 Views
Last Modified: 2012-05-10
Hi guys,

I have a folder on my website called admin, which I protected using .htaccess and it works well. There is a subfolder called "uploaded images" that I need to let anybody access. How do I edit the htaccess file to do this?
0
Comment
Question by:Paulclane
  • 4
  • 2
6 Comments
 
LVL 3

Expert Comment

by:scottbisker
ID: 34202022
If the subfolder is inside the admin folder then I don't think you'll be able to do that.  If you are a unix box, you could put the images folder up one level and put a symbolic link in the admin folder.  
0
 

Accepted Solution

by:
Paulclane earned 0 total points
ID: 34204008
Hi Scott,

I have googled symbolic link and I'm a little confused. This is the path to the current image_uploads folder:

/hsphere/local/home/sitename/sitename.com/admin/image_uploads/

I think that you want me to move the folder to:

 /hsphere/local/home/sitename/sitename.com/

and then run a unix command on the admin folder. Something like this:

ln -s /hsphere/local/home/sitename/sitename.com ./image_uploads

Am I getting close?

 I have Dreamweaver CS3 and Cute FTP Pro.

If I set up this link, will I be able to upload the images into the image_uploads folder, which would now be outside the password protected admin folder, without having to change the path in the uploader?

I'm terrible at web dev/coding, so I really appreciate your help!
0
 
LVL 3

Expert Comment

by:scottbisker
ID: 34205604
Here's what you need to do.

On the server, open up a command shell.

1.  cd /hsphere/local/home/sitename/sitename.com/admin
2.  mv image_uploads ..
3.  ln -s ../image_uploads .

First command changes to the correct directory.
Second command moves the image_uploads directory up a level.  
Third command puts a symbolic link for the image_uploads directory into the admin directory.

Then when you are using Cute FTP pro, you'll be able to drop images into   www.whatever.com/image_uploads
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

Author Comment

by:Paulclane
ID: 34207525
That's a very clear instruction, thank you!.
The reason that I haven't just moved the folder and uploaded images to the moved folder is that the site is a CMS site using TinyMCE. When we upload a product and add images onto the page, it does done using a built-in image uploader, which puts them into the image_uploads folder in admin, so the files will still be uploaded to this folder in admin.
I know I should have mentioned this before, it was a stupid over-sight on my behalf, apologies. I am going to see if I can change the default upload location of the images uploader, evern though I don't have a clue how, but I presume I can just search the .php's until I find the one that mentions image_uploads and edit that
0
 

Author Comment

by:Paulclane
ID: 34515766
I have moved the default images folder to outside the protected folder, so problem solved.

Thanks for your help!
0
 

Author Closing Comment

by:Paulclane
ID: 34608891
Excellent Help!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
File download script VBSCRIPT fail on download PPT files 2 59
tag title an image 13 32
Connection to multiple databases 13 25
Help in good tutorials for PHP, HTML and CSS 6 40
An enjoyable and seamless user experience can go a long way on an eCommerce site. While a cohesive layout and engaging copy play roles in creating a positive user experience, some sites neglect aspects that seem marginal but in actuality prove very …
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question