2016-03-15 60 views

回答

2

重命名server.php在你的Laravel根文件夹的index.php/公共目录复制的.htaccess文件在你的Laravel根文件夹中。
在.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] 
+0

路径显示404所有的CSS和JS图像 – minc

+0

@minc:为解决这个问题,你设置的CSS和这样<链接HREF =“{JS链接{资产( 'CSS/app.css')}}”的rel = “样式表” 类型= “文本/ CSS”>和 并把你所有的JS和CSS文件中的公共/文件夹 –

+0

K,我得到了和现在我已经更新了规则,并为我工作。 Ca't我们排除整个资产目录,而不是每个扩展 – minc