我有一个基本的问题我解决不了。
我在Debian 10机器上设置了一个LAMP服务器,它运行在Docker容器中。
PHP和服务Apache和MySQL的功能,但我有一个问题与URL重写。它不能运行,即使在我的web服务器的基本入口点:"http://localhost/">
如果我使用真实地址,它可以工作,但如果我使用"虚拟"地址;地址像"http://localhost/toto"例如,我从Apache得到一个404错误。这是我的。htaccess文件的内容,我把它放在根目录"/var/www/html":
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"在loadd_module .
有谁知道我怎么解决这个问题吗?
之旅
最后…,没关系!
我的。haccess文件刚刚被Apache忽略了,因为AllowOverride语句被设置为"None"默认在my "apache2.conf"
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
我通过"AllowOverride all"修改了它,我保留了Apache,我可以证明重写工作得很好。