dongsigan2044 2018-01-23 02:36
浏览 86
已采纳

单个Laravel路由在CloudWays上的Apache中不起作用

I have a Laravel installation on DigitalOcean through CloudWays in which one of the routes doesn't work. It has nginx serving static content and Apache serving the dynamic pages. Every route works fine, except for the following one:

Route::get('/r/{id}/{url}', 'CampaignController@redirect')
    ->where('url', '(.*)?');

On my localhost through php artisan serve, it works and on another installation on nginx it works fine. This is a client's server and although he has granted my account full access to the server, sudo is disabled and I can't touch anything outside of the public_html directory, so I'm assuming it's doable through .htaccess, here's what I have now:

<IfModule mod_rewrite.c>
    Options +FollowSymLinks
    RewriteEngine On
</IfModule>

# For all files not found in the file system, reroute the request to the
# "index.php" front controller, keeping the query string intact

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>  
  • 写回答

1条回答 默认 最新

  • dongya1228 2018-02-10 22:05
    关注

    The problem was that I was URL-encoding another address with slashes and Apache decoded it and interpreted it as a different path while nginx didn't. The solution was to use another encoding.

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

报告相同问题?

悬赏问题

  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示