需要重写./php/文件夹下的1.php 到index.php
因为location ~ .*\.php$ 全部交给fastcgi了,会显示404 无法重写
在location ~ .*\.php$ 前重写规则 php又无法解析
怎么办?
location ~ .*\.php$
{
fastcgi_pass unix:/tmp/php-cgi-f.sock;
fastcgi_index index.php;
include fcgi-host.conf;
fastcgi_param DOCUMENT_ROOT /web$subdomain;
fastcgi_param SCRIPT_FILENAME /web$subdomain$fastcgi_script_name;
}
location ~ ^/ {
rewrite ^/php/([0-1000]+).php$ /php/index.php?id=2&cid=$1&num=$args last;
}
(不直接写入到php里面而重写有各种原因,只求用nginx解决这个问题)
因为location ~ .*\.php$ 全部交给fastcgi了,会显示404 无法重写
在location ~ .*\.php$ 前重写规则 php又无法解析
怎么办?
location ~ .*\.php$
{
fastcgi_pass unix:/tmp/php-cgi-f.sock;
fastcgi_index index.php;
include fcgi-host.conf;
fastcgi_param DOCUMENT_ROOT /web$subdomain;
fastcgi_param SCRIPT_FILENAME /web$subdomain$fastcgi_script_name;
}
location ~ ^/ {
rewrite ^/php/([0-1000]+).php$ /php/index.php?id=2&cid=$1&num=$args last;
}
(不直接写入到php里面而重写有各种原因,只求用nginx解决这个问题)