如何将以.PHP结尾的特定urlredirect到Nginx中的另一个url?

如果URL以.HTML结尾,我没有问题控制它,并在Joomla中redirect。 但是如果以.PHP结尾,我会得到404页面。

我认为它可以解决以下两种方法之一:1.给Joomla控制以PHP结尾的URL,以便我可以从Joomla或2中redirectURL。尝试在NGINXconfiguration中执行:

location / { try_files $uri $uri/ /index.php?$args; } location /oldsignup.php { rewrite ^/.* http://example.com/signup.html permanent; } location /oldsignup2.php { rewrite ^/.* http://example.com/signup.html permanent; } 

我试过以上,但失败了。

修正了它:

 rewrite ^/oldsignup1.php$ http://example.com/signup.html permanent; rewrite ^/oldsignup2.php$ http://example.com/signup.html permanent; location / { try_files $uri $uri/ /index.php?$args; }