Solved

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

Posted on 2010-11-23
6
642 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
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…

832 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