首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >.htaccess没有在本地主机上工作(manjaro)

.htaccess没有在本地主机上工作(manjaro)
EN

Stack Overflow用户
提问于 2021-07-26 17:19:42
回答 1查看 454关注 0票数 0

我花了一个下午的时间来解决这个问题,但我一个人解决不了。

我一直在VSCode中尝试通过使用.htaccess来实现一个管理区域,但是页面将在没有询问我的情况下加载。

我没有任何错误,我在/var/log/httpd/error_log也没有。

我将AutoOverride在httpd.conf中修改如下:

代码语言:javascript
运行
复制
# 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文件:

代码语言:javascript
运行
复制
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项目复制到其中,但它没有改变任何东西)。

提前感谢你帮助我度过痛苦.!

EN

回答 1

Stack Overflow用户

发布于 2021-12-13 10:32:08

我建议以下解决办法:

  1. 编辑/etc/httpd/conf/
  2. /httpd-userdir.conf文件更改:

AllowOverride Option1 Option2 Option3

至:

代码语言:javascript
运行
复制
AllowOverride All

  1. 保存并重新启动

sudo systemctl重新启动httpd

  1. 测试它。
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68534046

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档