Centos htaccess not being read

后端 未结 5 1740
终归单人心
终归单人心 2021-02-05 22:44

I\'m working on a new server and I installed via yum the \"Web Server\" group. Php and mysql work fine but I can\'t get .htaccess to work.

Heres my test .htaccess file:<

5条回答
  •  深忆病人
    2021-02-05 23:26

    On CentOS7, the following should help:

    1. Under string AllowOverride controls what directives may be placed in .htaccess files in /etc/httpd/conf/httpd.conf:replace AllowOverride None to AllowOverride All

    2. In /etc/httpd/conf.modules.d/00-base.conf check rewrite_module must be:

      LoadModule rewrite_module modules/mod_rewrite.so

    3. .htaccess file must be in /var/www/html/

    4. Example content .htaccess:

      AuthUserFile /var/www/.htpasswd AuthGroupFile /dev/null AuthName "Please Enter Password" AuthType Basic Require valid-user

    5. check and restart Apache:

      httpd -t

      /bin/systemctl restart httpd.service

提交回复
热议问题