.htaccess password help

Soldato
Joined
6 Jan 2006
Posts
3,437
Location
Newcastle upon Tyne
Ok Ive searched the forums and its either not what I want or double dutch to me!!

I want to protect a certain folder on my website /admin, and I know I can do this with .htaccess so I uploaded the one that came with oscommerce and it worked fine. Searched the net to find the code to go in the .htaccess file and when I overwrite the original I get a 500 error on the site. Put the old /htaccess file back and it works again.

Could someone please tell me the code that I need to put in the .htaccess so that I can protect the admin section.

Thanks, Mark
 
Mark M said:
I scrapped the whole thing and am starting from fresh from the above link.

What does the following mean...



:confused:

On your hosting they'll be a few folders your web root is usually the www folder on there, anything outside that is outside the web root.
 
It means don't store it anywhere within your wwwroot directory or below if you can help it.

On *nix boxes: /var/www/html/ is the web root and on a Win machine it is c:\inetpub\wwwroot

You store it outside the web root so there is no chance of the end user being able to call it :)
 
How do I upload it there? Im using cute FTP and it only shows up folders that are accessible I think?

Thanks again, Mark
 
when you ftp in you should be able to see all folders including those outside the route which might include so folders storing your mail, and stats etc.
 
based on your screenshot thats your webroot , there should be another level or two above that.

check your hostings control panel as there should be a file section on there that'll show you the full directory structure.

Sometimes when you setup ftp accounts on the hosting packages they default to the web root and only the master ftp account gets you to the top directory.
 
Dinesh: We do not allow access to that area
Dinesh: You can only save your htaccess or htpasswd to your root directory#

Any further ideas?
 
Mark M said:
It doesnt have the name of it on the bottom so I have taken a screen shot


give use some screen shots of the file manager and the advanced sections please
 
The web root folder is the folder within your hosting account that contains the files that are accessed when someone points their browser to your domain url. For example:

http://www.mydomain.com/index.html

will access the file index.html in the web root folder within your hosting account, this folder is usually called 'public_html' or 'www' as has already been explained.

Regarding the .htaccess passwords thing, the point of storing the passwords file outside fo the web root folder is so that it cannot be accessed over the web (using a web browser) for all to see. If you store it in the directory above the web root, then it cannot be accessed over the web and is much more secure.

When you ftp into your account, the default folder (/) is your account home folder, within which will reside your web root folder (amount others). It is in the account home where the passwords file should reside.
 
Last edited:
nero120 said:
When you ftp into your account, the default folder (/) is your account home folder.

Not in this case mate, read the thread, it seems his hosting provider is limiting his access to just the web root
 
Back
Top Bottom