Help - Search - Members - Calendar
Full Version: Having Trouble Using .htaccess And .htpasswd
Zymic Webmaster Forums > Zymic Free Web Hosting > Zymic Free Web Hosting - General Discussion & Help
LancerB1
Ok, I want to protect contents in one of my folders named assets_folder using .htaccess and .htpasswd to block anonymous users from accessing files in the folder like my Style Sheets, JavaScripts, etc. if they know the URL if they view the page source code.

This is my .htaccess file that I placed in my assets_folder:

CODE
AuthName "Restricted Area"
AuthType Basic
AuthUserFile /jangosfist.clanteam.com/assets_folder/.htpasswd
AuthGroupFile /dev/null
require valid-user


I placed the .htpasswd file in the general directory of my site along with my index.html and some other web pages. I'm using an external Style Sheet for my index.html page, but when I visit I get a prompt telling me to enter my user name and password. When I cancel the authentication page my style sheet doesn't load and I just get an ugly looking page. I used this site to create my .htaccess and .htpasswd code to protect my assets_folder: http://www.tools.dynamicdrive.com/password/
Perry
I believe if you read further down the dynamic drive page it answers your question wink.gif

QUOTE
Q: I've uploaded my .htaccess and .htpasswd files to the correct locations, but when I try and enter my username/password to enter the protected area, it still wouldn't let me in!
A: Make sure you've in fact uploaded your .htpasswd to the location as specified in the "AuthUserFile" line inside .htaccess. For example:

AuthUserFile /home/mysite/.htpasswd

As mentioned, in Linux you can type "pwd" in telnet/SSH to find out your server's root directory (ie: /home/mysite). If the location is incorrect and your server can't properly locate .htpasswd, the username and password contained within this file won't be recognized either, and you are locked out. Regardless, you can reverse any changes and unpassword protect your directory simply by deleting the .htaccess file you uploaded to that directory.
LancerB1
Hmm, well I think I did that what the site told me to do, but it only asked for authentication on my JavaScript files. I want to try another method to hide my files by using .htaccess to block all IP addresses, but would it also stop CSS and Javascript from executing on my pages?
Perry
Yes, It would.
LancerB1
Ok, I have a problem with .htaccess. When I try to delete the file, I get a message that "File ".htaccess" can't be deleted". I've tried to delete the file with FireFTP, but had no luck. How do I delete this file or even this folder because it isn't letting me deleted at the moment.
http://jangosfist.clanteam.com/test_folder/Test_Document.txt
Edward9958
My approach was to set up .htaccess and .htpasswd to work the way I wanted on my home machine. This done I used PHP function getcwd() to give me the path on my directory on zymic. I then edited this path into my .htaccess file and ftp'ed this, along with the .htpasswd file to my zymic webspace.

For a demo go to my site http://zcpa.uuuq.com/

and Navigate to the minutes section. If you want the username and password you'll have to become a member, sorry, committee's orders.

Hope this helps, works with quite a few hosts BTW.

QUOTE(LancerB1 @ Oct 16 2009, 12:12 AM) *
Ok, I want to protect contents in one of my folders named assets_folder using .htaccess and .htpasswd to block anonymous users from accessing files in the folder like my Style Sheets, JavaScripts, etc. if they know the URL if they view the page source code.

This is my .htaccess file that I placed in my assets_folder:

CODE
AuthName "Restricted Area"
AuthType Basic
AuthUserFile /jangosfist.clanteam.com/assets_folder/.htpasswd
AuthGroupFile /dev/null
require valid-user


I placed the .htpasswd file in the general directory of my site along with my index.html and some other web pages. I'm using an external Style Sheet for my index.html page, but when I visit I get a prompt telling me to enter my user name and password. When I cancel the authentication page my style sheet doesn't load and I just get an ugly looking page. I used this site to create my .htaccess and .htpasswd code to protect my assets_folder: http://www.tools.dynamicdrive.com/password/

Joseph9560
Offtopic but I tried
CODE
ErrorDocument 404 /404page.php
, created a 404 page but error!! Incompatible htaccess blah blah blah! Sorry but I haven't learned htaccess. Can anybody help me create htaccess for 404 and 403 page!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2012 Invision Power Services, Inc.