« Redirect index.php to rootAlexa Toolbar Add-On for Firefox Works! »
Troubleshooting Apache .htaccess Authentication
Apache Web Server users sometimes have problems getting Apache Authentication/password-protection in htaccess working, this is a troubleshooting guide to get Password Protection working!
You might want to check out my Ultimate Apache htaccess Tutorial. For specific help or to ask questions use the forum.
Apache Documentation: 1.3 | 2.0 | 2.2 | Current
Add this to your httpd.conf (if on non-windows) but I would imagine that these are already loaded.
LoadModule access_module lib/modules/mod_access.so LoadModule auth_module lib/modules/mod_auth.so LoadModule auth_anon_module lib/modules/mod_auth_anon.so LoadModule auth_dbm_module lib/modules/mod_auth_dbm.so LoadModule auth_digest_module lib/modules/mod_auth_digest.so
Add a .htaccess file in the directory you want to protect with the following code.
AuthType Basic AuthName "Restricted Files" AuthUserFile /path/to/htpwd/.htpasswd Require valid-user
chmod your .htpasswd files 640, .htaccess files 644
chmod php files 600, chmod files that you really dont want people to see as 400 (wp-config.php) and NEVER chmod 777, if something requires write access use 766 or 775
CHMOD your .htaccess file 644 which translates to rw-r-r
chmod your .htpasswd file 640 (rw-r–)
$ chmod 644 .htaccess $ chmod 640 .htpasswd
If you are on linux/bsd then goto a shell and cd into the directory that the .htaccess/.htpasswd file is located in and type the following commands to get rid of any windows formatting, which is oftentimes the problem.
$ dos2unix -dv .htaccess $ dos2unix -dv .htpasswd
Make sure that in your httpd.conf file in the code for your docroot or public_html directory you see at least the following after the AllowOverride directive:
AllowOverride AuthConfig
Once you see a password prompt then you can use this online htpasswd generator for your .htpasswd file.
httpd binary that can be loaded on-demand./usr/local/apache2/conf/httpd.conf, but it may be moved using run-time or compile-time configuration.GET, POST, and PUT.httpd binary are called static modules, while modules that are stored separately and can be optionally loaded at run-time are called dynamic modules or -> DSOs. Modules that are included by default are called base modules. Many modules are available for Apache that are not distributed as part of the Apache HTTP Server -> tarball. These are referred to as third-party modules.http or https, a hostname, and a path. A URL for this page is http://askapache.info/2.0/glossary.html.« Redirect index.php to root
Alexa Toolbar Add-On for Firefox Works! »
The love of liberty is the love of others; the love of power is the love of ourselves.
-- William Hazlitt
The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect. Tim Berners-Lee
in Debian (and children)
Must do:
$ chown www-data:www-data .htpasswd $ chmod 640 .htpasswd
When sending an Email attachment of any kind (though it have been most tested with DOC files) the file arrives the destination as a ATT*.DAT file.
Tags: Apache, Apache Htaccess, askapache, ASP, authorization, Cache, chmod, Dig, Elite, encryption, Examples, GET, HowTo, Htaccess, htaccess files, htaccess tutorial, Htpasswd, httpd, httpd.conf, HTTPS SSL, Linux, password, password protection, PHP, Port, post, Prompt, ram, Robot, robots, Security, server, Shell, Socket, SSH Tunnels, stat, tutorial, wp-config.php,
It's very simple - you read the protocol and write the code. -Bill Joy
HTML | DCMI | GRDDL | XOXO | XDMP | XFN | DOM | XML | XHTML 1.1 Strict | CSS 2.1 | W3C
Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution 3.0 License, just credit with a link.
This site is not supported or endorsed by The Apache Software Foundation (ASF). All software and documentation produced by The ASF is licensed. "Apache" is a trademark of The ASF. NCSA HTTPd.
UNIX ® is a registered Trademark of The Open Group.
POSIX ® is a registered Trademark of The IEEE.
so problem can not be solved?