我在DigitalOcean上通过CloudWays安装了一个Laravel,其中一个线路不能工作。它有nginx为静态内容服务,Apache为动态页面服务。除下列路线外,每条路线都很好:
Route::get('/r/{id}/{url}', 'CampaignController@redirect')
->where('url', '(.*)?');在我通过php artisan serve的本地主机上,它可以工作,而在nginx上的另一个安装上,它可以正常工作。这是一个客户机的服务器,虽然他已经允许我的帐户完全访问服务器,但是sudo是禁用的,我不能在public_html目录之外碰任何东西,所以我假设它可以通过.htaccess完成,下面是我现在拥有的:
<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> 发布于 2018-02-10 22:05:17
问题是,我正在用斜杠对另一个地址进行URL编码,Apache将其解码,并将其解释为不同的路径,而nginx则不这样做,解决方案是使用另一种编码。
https://stackoverflow.com/questions/48393332
复制相似问题