如果您已经运行了sudo a2enmod rewrite命令,但URL重写不起作用。制造。htaccess文件按预期工作,您需要编辑此文件:
Step1 : sudo vi /etc/apache2/sites-available/default
Step2 : 查找如下所示的部分:
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
# <Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
# Uncomment this directive is you want to see apache2\'s
# default start page (in /apache2-default) when you go to /
#RedirectMatch ^/$ /apache2-default/
</Directory>
# Uncomment this directive is you want to see apache2\'s
# default start page (in /apache2-default) when you go to /
#RedirectMatch ^/$ /apache2-default/
</Directory>
您需要修改包含AllowOverride None的行以读取AllowOverride All。
step3 : sudo/etc/init。d/apache2重新加载