- 找到
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容器