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

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

  • 写回答

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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥15 stable diffusion
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿