我有一个url:
http://devs.website.com.au/
然后,如果我把这个url在浏览器中
http://devs.website.com.au/index.php
我正在redirect到
http://devs.website.com.au/
在nginx中使用这段代码可以正常工作
if ( $request_uri ~ "/index.(php|html?)" ) { rewrite ^ /$1 permanent; }
但是,如果我有这个现有的页面:
http://devs.remotestaff.com.au/sample-page.php
然后我试了一下,
http://devs.remotestaff.com.au/sample-page.php/index.php
正如预期的那样,它会重新回到:
http://devs.website.com.au/
在我的nginx规则中定义,是否有一种方法,每当nginx看到index.php或index.html在URL的末尾,它将redirect到请求的url没有index.php或index.html
所以当我这样做: http://devs.remotestaff.com.au/sample-page.php/index.php : http://devs.remotestaff.com.au/sample-page.php/index.php
它应该redirect到:
http://devs.remotestaff.com.au/sample-page.php/