vue 項目部署後 刷新一下 頁面找不到 解決

1.修改配置router的參數  (效果很差)javascript

2. (不能解決 出現403)php

後端配置例子

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.發現這個配置依然有問題 繼續排坑 html


在httpd.conf找了一下,<Directory>權限配置的問題,XAMPP默認的設置是這樣的:vue

#<Directory />
   AllowOverride none
    Require all denied
</Directory>java

修改爲下面web

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>vue-cli

 

4.仍是不行 繼續排坑 最終解決!

後端

<Directory "D:/Documents/abc/php/basic/web">
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Require all granted
</Directory>

  

5.補充 根本緣由 ide

 01.httpd-vhosts.conf的配置ui

  

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

相關文章
相關標籤/搜索