vue 项目部署后 刷新一下 页面找不到 解决
1.修改配置router的参数 (效果不好)
2. (不能解决 出现403)
后端配置例子 Apache <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.html$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.html [L] </IfModule>
3.发现这个配置依然有问题 继续排坑
在httpd.conf找了一下,<Directory>权限配置的问题,XAMPP默认的设置是这样的:
#<Directory />
AllowOverride none
Require all denied
</Directory>
修改成下面
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
4.还是不行 继续排坑 最终解决!
<Directory "D:/Documents/abc/php/basic/web"> Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Require all granted </Directory>
5.补充 根本原因
01.httpd-vhosts.conf的配置
NameVirtualHost *:9090
<VirtualHost *:9090>
ServerAdmin webmaster@dummy-host.localhost
DocumentRoot "D:\work\web\vue-cli-work\dist"
ServerName www.tongtong.com
ServerAlias *.www.tongtong.com
ErrorLog "logs/localhost-error_log"
</VirtualHost>
02. .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>
03.其他参考 http://www.cnblogs.com/tongbiao/p/9403381.html
https://www.tongbiao.xyz/