小编Fel*_* S.的帖子

.htaccess 不工作(apache2 | ubuntu 18.04)

伙计们,网站运行良好,只是文件 .htaccess 不起作用,我用谷歌搜索了很多,已经启用a2enmod rewrite并尝试了很多东西,但没有用。

obs:我以网站example.com为例

这就是我/etc/apache2/sites-available/000-default.conf的:

<VirtualHost *:80>

    ServerAdmin admin@example.com
    ServerName example.com
    ServerAlias www.example.com
    DocumentRoot /var/www/example.com/public_html

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>
Run Code Online (Sandbox Code Playgroud)

这就是我/etc/apache2/apache2.conf的:

<Directory />
        Options FollowSymLinks
        AllowOverride All
        Require all denied
</Directory>

<Directory /usr/share>
        AllowOverride None
        Require all granted
</Directory>

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
</Directory>
Run Code Online (Sandbox Code Playgroud)

我的 .htaccess 是这样的:

#DISALOW DIRECTORY LISTING
Options -Indexes

ErrorDocument 400 /.error.php
ErrorDocument 401 /.error.php
ErrorDocument 403 /403.php
ErrorDocument 404 /404.php
ErrorDocument 405 …
Run Code Online (Sandbox Code Playgroud)

apache2 .htaccess

5
推荐指数
1
解决办法
2956
查看次数

标签 统计

.htaccess ×1

apache2 ×1