我有nginx + php-fpm,當我嘗試訪問'/ rest/proccess'時,我想要$ _SEVER ['REQUEST_URI'] =='/ process'。所以我就創造了這樣的配置對於nginx的:重寫request_uri失敗
location /rest/ {
root /var/www/php;
rewrite ^/rest/(.*)$ /$1 break;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
include fastcgi_params;
}
但它不工作,在PHP我有$ _SEVER [ 'REQUEST_URI'] == '/ REST /過程'。
我在做什麼錯了?
日Thnx
UPD:看來重寫規則僅重寫DOCUMENT_URI $,但不REQUEST_URI $,所以$ _SEVER [ 'REQUEST_URI'] == '/ REST /工藝' 和$ _SEVER [ 'DOCUMENT_URI'] == '/過程'
嗯,網址具有架構的http:// ...或ftp:// .... – Eugen
URL方案http:// – glagola
[用Nginx和PHP重寫fastcgi仍然會將舊請求\ _uri重新發送到後端(php和symfony)](http://stackoverflow.com/questions/8339183/rewrite-with-nginx-and-php-fastcgi-still-sends-old-request-uri-to-backend-php-a) – hakre