nginx rewrite


location ~ "(product)\.php" {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /data/t_php/test_re/search$fastcgi_script_name;
include fastcgi_params;
}

location / {

rewrite "^/(.*)\/(\d{2})\.html" /product.php?action=product_detail&type=$1&product_id=$2 last;

}


访问 http://tool.yebanhei.com:8090/hh/10.html

打印$_GET 如下:

array(2) {
  ["type"]=>
  string(2) "hh"
  ["product_id"]=>
  string(2) "10"
}

 

 

发表评论

电子邮件地址不会被公开。 必填项已用*标注