首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在CloudWays上不使用Apache的单Laravel路由

在CloudWays上不使用Apache的单Laravel路由
EN

Stack Overflow用户
提问于 2018-01-23 02:36:45
回答 1查看 268关注 0票数 0

我在DigitalOcean上通过CloudWays安装了一个Laravel,其中一个线路不能工作。它有nginx为静态内容服务,Apache为动态页面服务。除下列路线外,每条路线都很好:

代码语言:javascript
复制
Route::get('/r/{id}/{url}', 'CampaignController@redirect')
    ->where('url', '(.*)?');

在我通过php artisan serve的本地主机上,它可以工作,而在nginx上的另一个安装上,它可以正常工作。这是一个客户机的服务器,虽然他已经允许我的帐户完全访问服务器,但是sudo是禁用的,我不能在public_html目录之外碰任何东西,所以我假设它可以通过.htaccess完成,下面是我现在拥有的:

代码语言:javascript
复制
<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>  
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-02-10 22:05:17

问题是,我正在用斜杠对另一个地址进行URL编码,Apache将其解码,并将其解释为不同的路径,而nginx则不这样做,解决方案是使用另一种编码。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/48393332

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档