0
我想重寫Apache中的.htaccess規則以用於Nginx服務器。apache/nginx:.htaccess重寫轉換混亂
RewriteCond $1 !^(index\.php|assets)
RewriteRule ^(.*)$ /index.php/$1 [L]
這是我有哪些工作,但一些更好的方向將不勝感激。我可以打索引,它加載好,並瀏覽資產文件夾罰款,但更深的鏈接不起作用(PHP程序正在從URL中提取變量以建立數據庫查詢)。我知道我很接近..謝謝你的回覆。
location/{
index index.php;
}
location /$ {
rewrite ^/(.*)$ /index.php/$1 last;
}
location /index.php {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;
include fastcgi_params;
}
邪惡的,這個偉大的作品!現在唯一的問題是查詢字符串沒有正確地傳遞給ajax頁面,並且它導致整個index.php重新加載到ajax的區域內。有關於此的任何想法? – wunderbar 2011-05-09 15:23:58
重寫位置/應自動保留查詢字符串。你編輯過你的fastcgi_params文件嗎?它應該有一行:fastcgi_param QUERY_STRING $ query_string; – kolbyjack 2011-05-09 20:19:36