0
我会尽量简短。我有以下的nginx重写网址:nginx重写&参数全url和文件扩展名
rewrite ^/(.*)?$ /index.php?completeURL=$1 last;
我要像一个网址:
http://mywebsite.com/http://www.otherwebsite.com/dir1/dirx/article.php&id=2&category=1
要求:
http://mywebsite.com/index.php?completeURL=http://www.otherwebsite.com/dir1/dirx/article.php&id=2&category=1
目前nginx的规则有问题。 示例:如果参数包含.php
扩展名,他会在我的服务器上查找该文件。
例子:http://mywebsite.com/dir1/dirx/article.php
如何解决在您看来这个问题呢?
UPDATE: 这里nginx的配置(和重写)文件:
- (配置)https://gist.github.com/ivanionut/cc53c9de372b932c3937d9394d3b448c
- (重写)https://gist.github.com/ivanionut/4df3ad9b858a54ae01461ab078adffb6
我想你的第二个解决方案,但我得到这个错误: '2016年4月26日22时21分05秒[错误] 10591#0:* 1846重写或内部重定向循环,同时重定向到命名位置“@rewrites”,客户端:xx.xx.xx.xx,服务器:website.com,请求:“GET /http://www.website.com/dfgdfgghgh.cfm HTTP/2.0”,主机:“ website.com“' – Ivan
如果/index.php不存在,它将循环。 'root'是否正确定义? –
嗨@Richard Smit。我更新了我的帖子。我已经包含了完整的nginx配置文件。试着给我们看看。 – Ivan