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 宇视监控服务器无法登录
  • ¥15 PADS Logic 原理图
  • ¥15 PADS Logic 图标
  • ¥15 电脑和power bi环境都是英文如何将日期层次结构转换成英文
  • ¥20 气象站点数据求取中~
  • ¥15 如何获取APP内弹出的网址链接
  • ¥15 wifi 图标不见了 不知道怎么办 上不了网 变成小地球了
  • ¥50 STM32单片机传感器读取错误
  • ¥50 power BI 从Mysql服务器导入数据,但连接进去后显示表无数据
  • ¥15 (关键词-阻抗匹配,HFSS,RFID标签天线)