0
我有一个网站,有laravel设置到http://www.example.com/lara/
下运行因此,大多数Laravel网页有http://www.example.com/lara/page/23
类型或http://www.example.com/lara/category/23
等的网址Nginx的URL重写
Nginx的是底层的服务器,它具有以下配置来处理这些请求:
location /lara/ {
try_files $uri $uri/ /lara/index.php?$query_string;
}
一切正常。
现在,我需要安装一个特殊的页面,这实际上是由 http://www.example.com/lara/category/29
处理,以得到这个工作,我增加了以下重写正下方location /lara/
的URL http://www.example.com/mystuff/
,那就是:
rewrite ^/mystuff/(.*)$ /lara/category/29/$1 last;
不幸的是,我得到一个页面未找到错误。任何见解?
进一步调查&研究:
1)
location /mystuff/ {
return 301 /lara/index.php/category/29;
}
工作,虽然这不是(浏览器地址栏更改)我真正想要的。
2)看起来Laravel没有看到更新的REQUEST_URI
。
,如果你把它上面的'位置/拉拉/'块怎么办? –
@RichardSmith我也试过,导致页面未找到错误。 – mishka
'/ lara/category/23 /'(尾部斜线)是否有效? –