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 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。
  • ¥20 CST怎么把天线放在座椅环境中并仿真
  • ¥15 任务A:大数据平台搭建(容器环境)怎么做呢?
  • ¥15 YOLOv8obb获取边框坐标时报错AttributeError: 'NoneType' object has no attribute 'xywhr'
  • ¥15 r语言神经网络自变量重要性分析
  • ¥15 基于双目测规则物体尺寸