Home Forums Classifieds Blogs Today's Posts Search Social Groups



  
SIGN-UP
Notices

Glock Talk
Welcome To The Glock Talk Forums.

 
  
Reply
 
Thread Tools Display Modes
Old 09-25-2009, 07:26   #1
Toyman
Senior Member
 
Toyman's Avatar
 
Join Date: May 2003
Location: West Michigan
Posts: 3,867
Web Server .htaccess files

Anyone here experienced with .htaccess files?

I've got it working with an .htaccess file in each directory, but now they want to protect files in a sub folder using just the .htaccess file in the root of the web server.

I think I need to use the DIRECTORY directive along with the FILES directive, but I can't seem to get it to work.

I can provide more details if there's someone really good at this.
__________________
Mike - A forum post should be like a skirt. Long enough to cover the subject material, but short enough to keep things interesting.
"It's not about the odds, it's about the stakes." -
To view links or images in signatures your post count must be 10 or greater. You currently have 0 signatures.
Toyman is offline   Reply With Quote
Old 09-25-2009, 10:53   #2
flyguy79
Member
 
flyguy79's Avatar
 
Join Date: Aug 2009
Location: Mansfield, TX
Posts: 28
Apache? If so, what version?

DIRECTORY directives don't work in .htaccess files - they have to go in httpd.conf or a virtual host block. The FILES directive will work in .htaccess, but you may want to go with a LOCATION directive, which matches URLs instead of file/directory paths.

Edit: scratch that - Location doesn't work in .htaccess either, but FILES does. What are you trying to block?
__________________
Jon
flyguy79 is offline   Reply With Quote
Old 09-26-2009, 05:57   #3
JimmyN
Senior Member
 
Join Date: Sep 2006
Location: Virginia
Posts: 1,541
I'm going to assume that "protect files" means you want to restrict folder/file access to certain IP addresses, require a user/password login to access the folder, etc.

.htaccess is a folder specific override. It applies to that folder and all sub folders equally. It was never intended to be placed in the root folder to restrict access only to a specific sub folder one or more levels below. Instead you place the .htaccess file in the folder you want to protect, as you apparently have it now.

If the .htaccess file you have in the root folder basically does what you want, but you have special needs for a particular sub folder under that, you can put another .htaccess file in that sub folder. It can override the rules in the parent/root folder, and either add or remove restrictions for that sub folder.

Putting it in httpd.conf with a directive is the best way to go, and you wouldn't need any .htaccess files in the folders. But if your site is hosted on a virtual server you won't have access to Apache's httpd.conf file, or the ability to re-start Apache to load the edited config file, so using .htaccess files is your only option.

I will gladly help you with it, just PM me. Our company has our own server which I manage, and we host several other business sites on it to help offset the cost of having our own equipment. And since I work from a home office the boss lets me moonlight, so I also take care of another six websites on the side. But I'm a *NIX/Apache guy, so if Microsoft is involved anywhere in this process I may not be much help.
__________________
** Sent from my rotary dial phone using TwirlaWord **
JimmyN is offline   Reply With Quote

 
  
Reply

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

Forum Jump




All times are GMT -6. The time now is 08:32.




Homepage
FAQ
Forums
Calendar
Advertise
Gallery
GT Wiki
GT Blogs
Social Groups
Classifieds


Users Currently Online: 925
265 Members
660 Guests

Most users ever online: 2,672
Aug 11, 2014 at 2:31