我使用此说明Laravel 5 – Remove Public from URL从路径中删除了“公共”
但是现在vue脚本不起作用。 如果添加到路径,则公共脚本有效(http://example.com/public/anket)
答案 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组件将再次工作。
致谢