只有删除index.php规则作为我的NginX和CodeIgniter重写。 为什么?

尽pipe我已经花了两天的时间在论坛上阅读,但我仍然无法在Nginx中重写一些Codeigniter重写。 这是服务器configuration:

server { listen *:80; server_name artademy.com www.artademy.com; root /var/www/artademy.com/web; index index.html index.htm index.php index.cgi index.pl index.xhtml; if (!-e $request_filename) { rewrite ^/(.*)$ /index.php?/$1; } if (!-e $request_filename) { rewrite ^/(index.php\?)/(.*)$ /$1/mobile_app last; break; } error_log /var/log/ispconfig/httpd/artademy.com/error.log; access_log /var/log/ispconfig/httpd/artademy.com/access.log combined; ## Disable .htaccess and other hidden files location ~ /\. { deny all; access_log off; log_not_found off; } location = /favicon.ico { log_not_found off; access_log off; } location = /robots.txt { allow all; log_not_found off; access_log off; } location /stats { index index.html index.php; auth_basic "Members Only"; auth_basic_user_file /var/www/clients/client0/web3/.htpasswd_stats; } location ^~ /awstats-icon { alias /usr/share/awstats/icon; } location ~ \.php$ { try_files $uri =404; include /etc/nginx/fastcgi_params; fastcgi_pass 127.0.0.1:9012; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_script_name; fastcgi_intercept_errors on; } } 

Codeigniter设置是:以及为uri_protocol:REQUEST_URI;

我注意到,从这个规则: rewrite ^/(.*)$ /index.php?/$1; 它的工作原理,但如果我这样写: rewrite ^/(.*)$ /index.php?; 。 这可能是一个疯狂的猜测,但它停在问号上。

无论如何,我需要的是从.htaccess这些规则:

 RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{QUERY_STRING} ^lang=([az]{2})$ RewriteRule ^([az]{2})$ index.php?/home_page?lang=$1 [L,QSA] RewriteRule ^([az]{2})$ index.php?/home_page?lang=$1 [L,QSA] #how_it_works RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^how-it-works/(en)$ index.php?/how_it_works?lang=en [L,QSA] #order_status RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^order-status/(en)$ index.php?/order_status?lang=en [L,QSA] 

任何人都可以告诉我我做错了什么,并告诉我至less有一个规则的正确方法? 这将是更有益的。 先谢谢你! ^^

PS:我通过使用uri_protocol的Path_info使它在apache上工作。 如果这个信息有任何帮助。 我记得也有类似的问题,但切换到path_info使这一切都很好。

PS.2:我的.htaccess工作正常,我确信。 例如,我想从artademy.com/how-it-worksES/es重写为arademy.com/index.php?/how_it_works?lang=es