输入如下显示可用模块等信息

sudo a2enmod
输入
rewrite
提示成功加载 rewrite 模块,然后修改 apache2 的配置文件
cd /etc/apache2 sudo vim apache2.conf
找到如下代码块,将 AllowOverride None
改为 AllowOverride All
<Directory /var/www/> Options Indexes FollowSymlinks AllowOverride None Require all granted </Directory>
重启 apache2
sudo /etc/init.d/apache2 restart
接下来就可以在网站目录创建.htaccess 配置伪静态了!