我一直试图让我的.htaccess
文件在我的本地主机上工作。我知道该文件有效,因为它在我的服务器上并且有效。但是它似乎并没有在本地工作。
我已经按照我能找到的教程将覆盖设置为所有,下面是我的/etc/apache2/sites-available/default
文件开始:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
Run Code Online (Sandbox Code Playgroud)
这是我的 nibble 站点在同一目录中的代码:
<VirtualHost *:80>
ServerName nibble.local
DocumentRoot /var/www/nibble_framework/web/
<Directory /var/www/nibble_framework/web/>
AllowOverride All
Options Indexes FollowSymLinks MultiViews
Allow from All
</Directory>
RewriteLog /var/www/rewrite.log
ErrorLog /var/log/apache2/error.log
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
我已经使用 a2ensite 启用了该站点并重新启动了 apache。我还将该站点添加到我的主机文件中:
127.0.0.1 nibble.local
Run Code Online (Sandbox Code Playgroud)
我已经使用 a2enmod 启用了 mod 重写并多次重新启动/重新加载 apache。
$ a2enmod rewrite
Module rewrite already enabled
Run Code Online (Sandbox Code Playgroud)
我的.htaccess …