【发布时间】:2021-11-14 17:13:07
【问题描述】:
我遇到了一个无法解决的基本问题。
我在运行 Docker 容器的 Debian 10 机器上设置了 LAMP 服务器。
PHP 和服务 Apache 和 MySQL 都可以正常运行,但我遇到了 URL 重写的问题。 它不运行,即使在我的网络服务器的基本入口点是:“http://localhost/”
如果我使用真实地址,它可以工作,但如果我将“虚拟”地址(例如“http://localhost/toto”)置于边缘,我会从 Apache 收到 404 错误。 这是我放在基目录“/var/www/html”根目录下的 .htaccess 文件的内容:
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_URI} !/index.php$
RewriteCond %{REQUEST_URI} !(.css|.js|.jpg|.jpeg|.png|.svg|.ttf|.woff|.woff2|.pdf|.zip|.mp4|.avi|.ogg)$
RewriteRule .* /index.php
在我的默认网站(/etc/apache2/sites-available/000-default.conf)的配置文件中,我有指令“DocumentRoot /var/www/html”。
如果我执行 phpinfo(),我会在加载模块中看到“mod_rewrite”。
有人知道怎么解决吗?
米凯尔
【问题讨论】: