【问题标题】:Inner page not found apache2 how to fix?apache2找不到内页怎么解决?
【发布时间】:2022-01-25 03:43:46
【问题描述】:

做这个

sudo a2enmod rewrite

也可以在位于 /etc/apache2 的 apache2.conf 文件中更改它

nano /etc/apache2/apache2.conf

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

最后重启 Apache

sudo service apache2 restart

但是在此之后我在任何页面上都获得了 500,如何解决?

.htaccess

RewriteEngine On
RewriteBase /


# The Friendly URLs part
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]


RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/{2,} [NC]
RewriteRule ^(.*) $1 [R=301,L]


RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
AddEncoding gzip .jgz


Header append Vary Accept env=REDIRECT_accept

AddType image/webp .webp


ExpiresActive On

【问题讨论】:

    标签: php apache


    【解决方案1】:

    对于此类错误需要通过此地址/var/log/apach2查看日志 在错误日志中我发现我在.htaccess 中使用了 some var 并且我的服务器不支持它,但是默认的

    $ sudo a2enmod headers
    $ sudo a2enmod expires
    $ systemctl restart apache2
    

    解决这个问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-04-16
      • 1970-01-01
      • 1970-01-01
      • 2022-10-15
      • 2023-02-08
      • 1970-01-01
      • 2022-06-15
      • 1970-01-01
      相关资源
      最近更新 更多