【发布时间】:2018-04-20 20:22:25
【问题描述】:
从我搜索的 url 中删除 public/ 并尝试按照这些步骤操作
- 从 public/ 复制 .htaccess 并将其粘贴到 root /
将 server.php 更改为 index.php
-
我试试哟添加
重写引擎开启 RewriteRule ^(.*)$ public/$1 [L]
到我的 /.htaccess 删除 url public 它没有工作。
但如果我删除那行它可以工作,但我所有的 URL 链接到 css 都是错误的路径
NOTE :: I PUT all my Css into public/assets if I move folder assets to my / It work but is their anyway If I dont want to move my floder assets
更新.htaccess
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
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]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
【问题讨论】:
-
可以在html中添加css链接吗?
-
我使用 {{asset('assets/css/bootstrap.min.css')}}
-
尝试添加这个
RewriteRule ^(css|js|images)/(.*)$ public/$1/$2 [L,NC]!!
标签: laravel laravel-5.5