本文介绍了htpasswd的和.htaccess - 内部服务器错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

希望有人也许能帮助这里弄清楚的问题!我一直在使用Google的2个多小时,并没有我尝试的工作...

hoping someone might be able to help figure out the problem here! I've been googling for over 2 hours and nothing I try is working...

我想用密码保护我的网站,但只要我添加了htpasswd的和.htaccess文件,我得到了一个服务器错误:

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 ErrorThe 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.

下面是code我使用:

Here is the code I'm using:

的.htaccess

AuthType Basic
AuthName "Top Secret for SongKick eyes only."
AuthUserFile /webroot/.htpasswd
require valid-user

htpasswd的

songkick:isS1rCTQE/p8E

我也试过的AuthUserFile /.htpasswd(即没有根目录,这是它似乎是在文件管理器中的文件夹的名称),但是这并不能工作。

I've also tried AuthUserFile /.htpasswd (ie. without "webroot", which is the name of the folder it appears to be in in File Manager) but this doesn't work either.

我使用GoDaddy的托管顺便说一句,如果有差别。

I'm using GoDaddy hosting btw, if that makes a difference.

任何帮助是非常AP preciated - !我不是开发人员,所以不明白了很多很多的帮助文章中使用的术语

Any help is much appreciated - I'm not a developer so don't understand a lot of the terms used in many of the help articles!

推荐答案

您必须提供完整的路径,你的密码文件,而不是从的DocumentRoot 的相对路径。

You must supply the complete path to your password file, not the relative path from DocumentRoot.

如果的DocumentRoot /无功/网络,密码文件是的/ var /万维网/ Webroot公司/ htpasswd的,你一定要说

If DocumentRoot is /var/www and the password file is /var/www/webroot/.htpasswd, you must say

AuthUserFile /var/www/webroot/.htpasswd

在你的.htaccess文件。

in your .htaccess file.

说,你不应该把你的密码文件中的的DocumentRoot 的任何地方访问。最好把它无法从网络访问的一些地方,如的/ etc / apache2的/ htpasswd的或者是任何一个适合你。

Said that, you shouldn't put your password file anywhere accessible in your DocumentRoot. Better put it in some place not accessible from the web, i.e. /etc/apache2/htpasswd or wherever it suits you.

这篇关于htpasswd的和.htaccess - 内部服务器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 14:25