注册 登录
编程论坛 PHP技术论坛

请教个伪静态的问题 apache换nginx

mak3me 发布于 2022-09-09 09:44, 780 次点击
我apache 换 nginx .很多页面都正常,就几个页面的地图出现404.
附 apache 伪静态和nginx  
ErrorDocument 404 /404.php
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)\.(asp|aspx|asa|asax|dll|jsp|cgi|fcgi|pl)(.*)$ /404.php
RewriteRule ^(.*)/file/(.*)\.php(.*)$ /404.php
RewriteRule ^(.*)-htm-(.*)$ $1.php?$2
RewriteRule ^(.*)/show-([0-9]+)([\-])?([0-9]+)?\.html$ $1/show.php?itemid=$2&page=$4
RewriteRule ^(.*)/list-([0-9]+)([\-])?([0-9]+)?\.html$ $1/list.php?catid=$2&page=$4
RewriteRule ^(.*)/show/([0-9]+)/([0-9]+)?([/])?$ $1/show.php?itemid=$2&page=$3
RewriteRule ^(.*)/list/([0-9]+)/([0-9]+)?([/])?$ $1/list.php?catid=$2&page=$3
RewriteRule ^(.*)/([A-za-z0-9_\-]+)-c([0-9]+)-([0-9]+)\.html$ $1/list.php?catid=$3&page=$4
RewriteRule ^(.*)/([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/index.php?moduleid=$2&catid=$3&itemid=$4&page=$5
RewriteRule ^(.*)/([a-z]+)/(.*)\.shtml$ $1/$2/index.php?rewrite=$3

RewriteRule ^(com)/([a-z0-9_\-]+)/([a-z]+)/(.*)\.html$ index.php?homepage=$2&file=$3&rewrite=$4
RewriteRule ^(com)/([a-z0-9_\-]+)/([a-z]+)([/])?$ index.php?homepage=$2&file=$3
RewriteRule ^(com)/([a-z0-9_\-]+)([/])?$ index.php?homepage=$2 [L]

RewriteRule  ^(.*)/([0-9]+)/?$ $1/show.php?&at=$3&itemid=$2
RewriteRule ^(house)/list-(r|b|t|p|f|l|o|h|n|g|j|e)([0-9A-Z_]+).html?$    $1/list.php?&$2=$3 [L]
RewriteRule ^(house)/list-r([0-9]+)-t([0-9]+)-p([0-9]+)-k(.*).html?$    $1/list.php?&r=$2&t=$3&p=$4&k=$5 [L]
RewriteRule ^(house)/map.html?$    map/newhouse.php [L]
RewriteRule ^(house)/([0-9]+)/?$ $1/show.php?&at=$3&itemid=$2 [L]
RewriteRule ^(house)/([0-9]+)/index.html?$ $1/show.php?&at=$3&itemid=$2 [L]
RewriteRule ^(house)/([0-9]+)/wenfang-g([0-9]+).html?$ extend/wenfang.php?mid=6&itemid=$1&page=$2 [L]
RewriteRule ^(house)/([0-9]+)/(xinxi|huxing|jiage|xiangce|wenfang|peitao|zixun|dianping|pic).html?$ $1/show.php?&at=$3&itemid=$2  [L]
RewriteRule ^(.*)/p([0-9]+)-h([0-9]+).html?$ $1/show.php?itemid=$2&houseid=$3
RewriteRule ^(house)/([0-9]+)/xiangce-c([0-9]+).html?$ $1/show.php?&at=xiangce&itemid=$2&catids=$3 [L]
RewriteRule ^(house)/([0-9]+)/hxinfo-([0-9]+).html?$ $1/show.php?&at=hxinfo&itemid=$2&id=$3 [L]
RewriteRule ^(house)/([0-9]+)/xcinfo-([0-9]+).html?$ $1/show.php?&at=xcinfo&itemid=$2&id=$3 [L]
RewriteRule ^(house)/([0-9]+)/huxing-s([0-9]+).html?$ $1/show.php?&at=huxing&itemid=$2&shi=$3 [L]
RewriteRule ^(house)/baojia.html?$     $1/baojia.php [L]
#经纪人规则
RewriteRule ^(broker)/index.html$    $1/index.php [L]
RewriteRule ^(broker)/list-(r|b|t|p|f|l|o|h|n|g|c|y|e|m|u|i)([0-9_]+).html?$    broker/index.php?&$2=$3     
RewriteRule ^(broker)/list-(.*).html?$    broker/index.php?&param=$2
#分销规则
RewriteRule ^(fenxiao)/list-(r|b|t|p|f|l|o|h|n|g|c|y|e|m|u|i)([0-9_]+).html?$    fenxiao/index.php?&$2=$3     
RewriteRule ^(.*)/d-([0-9]+).html$ $1/detail.php?itemid=$2
#二手房规则
RewriteRule ^(sale)/map.html?$    map/index.php [L]
RewriteRule ^(rent)/map.html?$    map/rent.php [L]
RewriteRule ^(map)/rent.html?$    map/rent.php [L]
RewriteRule ^(map)/sale.html?$    map/index.php [L]
RewriteRule ^(map)/house.html?$    map/newhouse.php [L]
RewriteRule ^(community)/([0-9]+)/(sale|rent)/list.html?$    $1/show.php?&at=$3&itemid=$2 [L]
RewriteRule ^(.*)/list.html$    $1/list.php [L]
RewriteRule ^(.*)/list-([a-z]+)([0-9A-Z_]+).html?$     $1/list.php?&$2=$3
RewriteRule ^(.*)/list-k(.*).html?$    $1/list.php?&k=$2 [L]
RewriteRule ^(.*)/list-(.*).html?$    $1/list.php?&param=$2  
RewriteRule ^(.*)/pk/(.+)?$ $1/compare.php?&itemid=$2 [L]
#小区规则
RewriteRule ^(community)/([0-9]+)/?$ $1/show.php?&at=$3&itemid=$2 [L]
RewriteRule ^(community)/([0-9]+)/index.html?$ $1/show.php?&at=$3&itemid=$2 [L]
RewriteRule ^(community)/([0-9]+)/(sale|rent|price|map).html?$ $1/show.php?&at=$3&itemid=$2  [L]

RewriteRule ^(community)/([0-9]+)/(sale|rent)/list(.*).html?$ $1/show.php?&at=$3&itemid=$2&str=$4 [L]
RewriteRule ^(community)/([0-9]+)/(sale|rent)/list(.*).html?$    $1/show.php?&at=$3&itemid=$2&list.php\?str=$4 [L]

RewriteRule ^(.*)/search.html$ $1/search.php [L]
RewriteRule ^(.*)/search-k([^/-]+).html$    $1/search.php?&kw=$2 [L]
RewriteRule ^(.*)/search-([^/-]+)-p([0-9]+).html$    $1/search.php&kw=$2&page=$3 [L]

RewriteRule ^(.*)/([0-9]+)/([a-z]+).html?$ $1/show.php?&at=$3&itemid=$2  [L]


RewriteRule ^(.*)/(.*)\.htm$ $1/404.php
RewriteRule ^(.*)/(.*)list(.*).html /$1/$2list.php\?str=$3




nginx



# nginx configuration by

error_page 404 /404.php;

location / {
rewrite ^(.*)/.(asp|aspx|asa|asax|dll|jsp|cgi|fcgi|pl)(.*)$ /404.php;
rewrite ^(.*)/file/(.*).php(.*)$ /404.php;
rewrite ^(.*)-htm-(.*)$ $1.php?$2;
rewrite ^(.*)/show-([0-9]+)([-])?([0-9]+)?.html$ $1/show.php?itemid=$2&page=$4;
rewrite ^(.*)/list-([0-9]+)([-])?([0-9]+)?.html$ $1/list.php?catid=$2&page=$4;
rewrite ^(.*)/show/([0-9]+)/([0-9]+)?([/])?$ $1/show.php?itemid=$2&page=$3;
rewrite ^(.*)/list/([0-9]+)/([0-9]+)?([/])?$ $1/list.php?catid=$2&page=$3;
rewrite ^(.*)/([A-za-z0-9_-]+)-c([0-9]+)-([0-9]+).html$ $1/list.php?catid=$3&page=$4;
rewrite ^(.*)/([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+).html$ $1/index.php?moduleid=$2&catid=$3&itemid=$4&page=$5;
rewrite ^(.*)/([a-z]+)/(.*).shtml$ $1/$2/index.php?rewrite=$3;

rewrite ^(com)/([a-z0-9_-]+)/([a-z]+)/(.*).html$ index.php?homepage=$2&file=$3&rewrite=$4;
rewrite ^(com)/([a-z0-9_-]+)/([a-z]+)([/])?$ index.php?homepage=$2&file=$3;
rewrite ^(com)/([a-z0-9_-]+)([/])?$ index.php?homepage=$2 last;

rewrite  ^(.*)/([0-9]+)/?$ $1/show.php?&at=$3&itemid=$2 ;

rewrite ^(house)/list-r([0-9]+)-t([0-9]+)-p([0-9]+)-k(.*).html?$    $1/list.php?&r=$2&t=$3&p=$4&k=$5 last;
rewrite ^(house)/map.html?$    map/newhouse.php last;
rewrite ^(house)/([0-9]+)/?$ $1/show.php?&at=$3&itemid=$2 last;
rewrite ^(house)/([0-9]+)/index.html?$ $1/show.php?&at=$3&itemid=$2 last;
rewrite ^(house)/([0-9]+)/wenfang-g([0-9]+).html?$ extend/wenfang.php?mid=6&itemid=$1&page=$2 last;
rewrite ^(house)/([0-9]+)/(xinxi|huxing|jiage|xiangce|wenfang|peitao|zixun|dianping|pic).html?$ $1/show.php?&at=$3&itemid=$2 last;
rewrite ^(.*)/p([0-9]+)-h([0-9]+).html?$ $1/show.php?itemid=$2&houseid=$3;
rewrite ^(house)/([0-9]+)/xiangce-c([0-9]+).html?$ $1/show.php?&at=xiangce&itemid=$2&catids=$3 last;
rewrite ^(house)/([0-9]+)/hxinfo-([0-9]+).html?$ $1/show.php?&at=hxinfo&itemid=$2&id=$3 last;
rewrite ^(house)/([0-9]+)/xcinfo-([0-9]+).html?$ $1/show.php?&at=xcinfo&itemid=$2&id=$3 last;
rewrite ^(house)/([0-9]+)/huxing-s([0-9]+).html?$ $1/show.php?&at=huxing&itemid=$2&shi=$3 last;
rewrite ^(house)/baojia.html?$     $1/baojia.php last;
#经纪人规则
rewrite ^(broker)/index.html$    $1/index.php last;
rewrite ^(broker)/list-(r|b|t|p|f|l|o|h|n|g|c|y|e|m|u|i)([0-9_]+).html?$    broker/index.php?&$2=$3 ;   
rewrite ^(broker)/list-(.*).html?$    broker/index.php?&param=$2 ;
#分销规则
rewrite ^(fenxiao)/list-(r|b|t|p|f|l|o|h|n|g|c|y|e|m|u|i)([0-9_]+).html?$    fenxiao/index.php?&$2=$3 ;   
rewrite ^(.*)/d-([0-9]+).html$ $1/detail.php?itemid=$2;
#二手房规则
rewrite ^(sale)/map.html?$  map/index.php last;
rewrite ^(rent)/map.html?$  map/rent.php last;
rewrite ^(map)/house.html?$ map/newhouse.php last;
rewrite ^(community)/([0-9]+)/(sale|rent)/list.html?$    $1/show.php?&at=$3&itemid=$2 last;
rewrite ^(.*)/list.html$    $1/list.php last;
rewrite ^(.*)/list-([a-z]+)([0-9A-Z_]+).html?$     $1/list.php?&$2=$3;
rewrite ^(.*)/list-k(.*).html?$    $1/list.php?&k=$2 last;
rewrite ^(.*)/list-(.*).html?$    $1/list.php?&param=$2 ;
rewrite ^(.*)/pk/(.+)?$ $1/compare.php?&itemid=$2 last;
#小区规则
rewrite ^(community)/([0-9]+)/?$ $1/show.php?&at=$3&itemid=$2 last;
rewrite ^(community)/([0-9]+)/index.html?$ $1/show.php?&at=$3&itemid=$2 last;
rewrite ^(community)/([0-9]+)/(sale|rent|price|map).html?$ $1/show.php?&at=$3&itemid=$2 last;

rewrite ^(community)/([0-9]+)/(sale|rent)/list(.*).html?$ $1/show.php?&at=$3&itemid=$2&str=$4 last;
rewrite ^(community)/([0-9]+)/(sale|rent)/list(.*).html?$    $1/show.php?&at=$3&itemid=$2&list.php?str=$4 last;

rewrite ^(.*)/search.html$ $1/search.php last;
rewrite ^(.*)/search-k([^/-]+).html$    $1/search.php?&kw=$2 last;
rewrite ^(.*)/search-([^/-]+)-p([0-9]+).html$    $1/search.php&kw=$2&page=$3 last;

rewrite ^(.*)/([0-9]+)/([a-z]+).html?$ $1/show.php?&at=$3&itemid=$2   last;


rewrite ^(.*)/(.*).htm$ $1/404.php;
rewrite ^(.*)/(.*)list(.*).html /$1/$2list.php?str=$3;
}
  
请教一下问题出现在什么地方.?
0 回复
1