我花了一个下午的时间来解决这个问题,但我一个人解决不了。
我一直在VSCode中尝试通过使用.htaccess来实现一个管理区域,但是页面将在没有询问我的情况下加载。
我没有任何错误,我在/var/log/httpd/error_log
也没有。
我将AutoOverride在httpd.conf中修改如下:
# Deny access to the entirety of your server's filesystem. You must
# explicitly permit access to web content directories in other
# <Directory> blocks below.
#
<Directory />
AllowOverride All
Require all denied
</Directory>
#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/srv/http"
<Directory "/srv/http">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride All
#
# Controls who can get stuff from this server.
#
Require all granted
</Directory>
和未注释的LoadModule rewrite_module modules/mod_rewrite.so
这是我的.htaccess文件:
RewriteEngine On
RewriteBase /
AuthName "Page d'administration protégée"
AuthType Basic
AuthUserFile "/home/badakzz/php/openclassroom/htdocs/sql/blog/admin/.htpasswd"
Require valid-user
老实说,我已经不知道该在哪里搜索了,我对Linux非常陌生,很少有人使用Manjaro,所以他们似乎没有使用"/srv/http“作为DocumentRoot (我试图将VSCode项目复制到其中,但它没有改变任何东西)。
提前感谢你帮助我度过痛苦.!
发布于 2021-12-13 10:32:08
我建议以下解决办法:
AllowOverride Option1 Option2 Option3
至:
AllowOverride All
sudo systemctl重新启动httpd
https://stackoverflow.com/questions/68534046
复制相似问题