douqingzhi0980
2016-02-01 15:12
浏览 50
已采纳

Laravel 5.1仅与FTP共享主机

I'm having trouble deploying laravel 5.1 to my shared hosting.

I have a current domain name : stefanogroenland.nl/laravel/public which shows the laravel welcome screen. Now i want to remove the need of /public so all my url's are nice and clean. Does anybody know how to fix this? i can only use FTP

if anybody knows please reply!

My FTP files under httpdocs

enter image description here

图片转代码服务由CSDN问答提供 功能建议

我在将laravel 5.1部署到我的共享主机时遇到了麻烦。

我有一个当前的域名: stefanogroenland.nl/laravel/public ,它显示了laravel欢迎屏幕。 现在我想删除/ public的需要,所以我的所有网址都很干净。 有人知道如何解决这个问题吗? 我只能使用FTP

如果有人知道请回复!

我在httpdocs下的FTP文件

< a href =“https://i.stack.imgur.com/rzejV.png”rel =“nofollow noreferrer”>

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dsjk3214 2016-02-01 15:19
    已采纳

    1) Rename the server.php to index.php (no modifications)

    2) Copy the .htaccess from public

    Changing .htaccess it a bit as follows for statics:

    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]
    

    If there are any other static files needed just add the extension to the previous declared list

    已采纳该答案
    打赏 评论

相关推荐 更多相似问题