.htpasswd

.htpasswd and .htaccess - internal server error

为君一笑 提交于 2019-11-30 01:48:24
问题 I want to password protect my website, but as soon as I add in the .htpasswd and .htaccess files I get a server error: Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. Here is the code I'm

.htaccess basic auth by virtual host?

那年仲夏 提交于 2019-11-29 17:58:57
问题 I was wondering if it was possible to setup a conditional http basic auth requirement based on the virtual host URL in an .htaccess file. For example what I want to do is have mysite.com and test.mysite.com run off the same code base in the same directory but password protect test.mysite.com. It would be setup this way so that I wouldn't need to branch my code since my app code can see which vhost/url it's being served from and pick the database to serve content from. 回答1: You can sort of

How to write “if…else” mod_rewrite statements in .htaccess

a 夏天 提交于 2019-11-29 15:40:39
I've scoured StackOverflow for an answer to this and seen many questions come close, but nothing is working for me yet. I'd like to have my .htaccess apply different rules based on the domain calling it. Basically, if subdomain.example.com is hit, redirect to google.com. If localhost is hit, redirect to yahoo.com. If www.example.com (or example.com) is hit, redirect to bing.com. I'll be adding in actual rewrite rules (setting environment variables and htpasswd protection) later, but first I need to get the "if then" part working. My (non-working) code is below. Any help is greatly appreciated.

htaccess doesn't work - always wrong password

*爱你&永不变心* 提交于 2019-11-29 01:07:28
I am trying to password protect a directory, and have two files in the directory which should password protected it: .htaccess .htpasswd HTACCESS: ###Contents of .htaccess: AuthUserFile /var/www/html/path/to/my/directory/.htpasswd AuthName "Protected Files" AuthType Basic Require user admin HTPASSWD: ###Contents of .htpasswd admin:oxRHPuqwKiANY The password is also admin, but no matter what password I try, it is always wrong. It immediately asks for the password again! What is wrong with this configuration? This problem is almost always because apache cannot read the .htpasswd file. There are

How to make Basic Auth exclude a rewritten URL

别等时光非礼了梦想. 提交于 2019-11-27 16:14:18
问题 I have a Basic Authentication setup on a development server. It is setup inside my httpd.conf file for the VirtualHost of the website. I've had to set up it to exclude certain directories, which has caused no problems and all works fine. The issue has been with excluding a URL that has been through my mod_rewrite rules in the .htaccess file. My set up is that I have all URLs going through my index.php file and from there the relevant code is found and ran. I tried adding the URL that I wanted

How to logout when using .htaccess (and .htpasswd) authentication? [duplicate]

别说谁变了你拦得住时间么 提交于 2019-11-27 13:01:35
问题 This question already has answers here : Closed 10 years ago . Possible Duplicate: HTTP authentication logout via PHP Hi I have a some functionality on my website protected using .htaccess and .htpasswd . When users attempt to access this, they get prompt to enter details. They enter their details and get in and can see stuff etc. All works fine. My question is how do I create a logout functionality for this type of authentication. I know that they can close the browser window to "Logout".

Programmatically building htpasswd

半世苍凉 提交于 2019-11-27 11:57:17
Is there a programmatic way to build htpasswd files, without depending on OS specific functions (i.e. exec() , passthru() )? Greg Roberts .httpasswd files are just text files with a specific format depending on the hash function specified. If you are using MD5 they look like this: foo:$apr1$y1cXxW5l$3vapv2yyCXaYz8zGoXj241 That's the login, a colon, ,$apr1$, the salt and 1000 times md5 encoded as base64. If you select SHA1 they look like this: foo:{SHA}BW6v589SIg3i3zaEW47RcMZ+I+M= That's the login, a colon, the string {SHA} and the SHA1 hash encoded with base64. If your language has an

Programmatically building htpasswd

元气小坏坏 提交于 2019-11-26 18:08:07
问题 Is there a programmatic way to build htpasswd files, without depending on OS specific functions (i.e. exec() , passthru() )? 回答1: .httpasswd files are just text files with a specific format depending on the hash function specified. If you are using MD5 they look like this: foo:$apr1$y1cXxW5l$3vapv2yyCXaYz8zGoXj241 That's the login, a colon, ,$apr1$, the salt and 1000 times md5 encoded as base64. If you select SHA1 they look like this: foo:{SHA}BW6v589SIg3i3zaEW47RcMZ+I+M= That's the login, a