nginx 302 yerine yeniden yazmak 200 yönlendirmeleri

0 Cevap php

Bir kullanıcı benim webserver üzerinde herhangi bir. Php dosya isterse ben onun isteğini istiyorum index.php tarafından ele alınması (örneğin, o mysite.com / testfile.php talep)

Index.php Ben kullanıcı (örneğin / testfile.php) görmek istediği sayfayı görmek için $ _SERVER ['REQUEST_URI'] kullanın, böylece index.php uygun html kodu üretebilir. Bu testfile.php var gerekmez dikkat edin.

Benim sorunum hep bir yönlendirme almak olduğunu 302 I (/ bir sonuç $ _SERVER ['REQUEST_URI'] gibi) testfile.php istemek çalıştığınızda / için. Ama ne istiyorum testfile.php için bir 200 OK olduğunu ve index.php bunun için doğru html-kod üretir.

Bu benim adamcağız nginx.conf bir parçası olduğunu:

 server {
 [...]

   root /home/test;

   # When I go to mysite.com redirect my to mysite.com/
   location = / {
   index index.php;
   }

   # For any php file request: let index.php handle the request
   location ~ \.(php)$ {
   include fastcgi_params;
   fastcgi_pass 127.0.0.1:9000;
   fastcgi_param  SCRIPT_FILENAME  /home/test/index.php;
   }
 }

Anyone can help me out? Thanks.

0 Cevap