- 找到
httpd.conf
配置文件(/usr/local/apache2/conf
) - 进入编辑
- 找到
#LoadModule rewrite_module modules/mod_rewrite.so
这一行并勾销正文 - 找到所有的
AllowOverride
,将默认值none
批改为All
(大概有三处,不要漏) - 在我的项目根目录(
/usr/local/apache2/htdocs
)新建.htaccess
文件,输出以下内容:
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.html$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.html [L]</IfModule>
保留后退出。
- 重启http容器