首页 > 解决方案 > 在 siteground 路线上上传 laravel 不起作用

问题描述

当在 siteground 服务器上上传 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]

那么为什么溃败没有起作用呢?

标签: laravel

解决方案


您可能必须将 laravel 的公共部分放在 /public_html 中,而不是 /public 中,这正是 Lavavel 所期望的。所以创建一个符号链接来创建一个假的 /public 文件夹:

ln -s public_html public

推荐阅读