从路径上移除公众后更正Vue

时间:2019-03-24 19:21:01

标签: php laravel-5 vue.js laravel-5.7

我使用此说明Laravel 5 – Remove Public from URL从路径中删除了“公共”

但是现在vue脚本不起作用。 如果添加到路径,则公共脚本有效(http://example.com/public/anket

1 个答案:

答案 0 :(得分:0)

修改后,您需要像这样更改.htaccess:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]

RewriteCond %{REQUEST_URI} !(\.css|\.js|\.png|\.jpg|\.gif|robots\.txt)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/public/
RewriteRule ^(css|js|images)/(.*)$ public/$1/$2 [L,NC]

这样,静态文件将不会被忽略,Vue组件将再次工作。

致谢