【发布时间】:2021-07-10 13:45:40
【问题描述】:
我是 Laravel 的新手,我正在测试我制作的应用程序。在本地它工作正常,但是当我将它推送到服务器时,路由似乎真的很糟糕。通常视图的路径类似于156.0.125.1/app/index,但它一直在寻找 156.0.125.1/index,这会导致在服务器上找不到 URL 的错误
我怀疑它是 .htaccess 文件,但我不太确定要在那里更改什么,因为我不熟悉它。
服务器上的站点似乎也无法读取 css 和 js
这是htaccess
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
# Disable Directory listing
Options -Indexes
# block files which needs to be hidden, specify .example extension of the file
<Files ~ "\.(env|json|config.js|md|gitignore|gitattributes|lock)$">
Order allow,deny
Deny from all
</Files>
【问题讨论】:
-
欢迎,你能提供.htaccess的内容吗?
-
对不起,忘了补充,现在有
标签: javascript php css laravel laravel-8