昊天SEO

apache伪静态转nginx【在线】

appche的伪静态规则是:

RewriteEngine on
<IfModule mod_rewrite.c>


RewriteRule ^index.html$ index.php
RewriteRule ^about_([0-9]+).html$ about.php?id=$1
RewriteRule ^product_([0-9]+)_([0-9]+).html$ products.php?clasid=$1&id=$2
RewriteRule ^products_([0-9]+).html$ products.php?id=$1
RewriteRule ^products.html$ products.php
RewriteRule ^solutions.html$ solutions.php
RewriteRule ^solution_([0-9]+).html$ solutions.php?id=$1
RewriteRule ^case.html$ case.php
RewriteRule ^case_([0-9]+).html$ case.php?pages=$1
RewriteRule ^case_([0-9]+)_([0-9]+).html$ case.php?clasid=$1&id=$2
RewriteRule ^news.html$ news.php
RewriteRule ^news_([0-9]+).html$ news.php?pages=$1
RewriteRule ^news_([0-9]+)_([0-9]+).html$ news.php?clasid=$1&id=$2
RewriteRule ^epc.html$ epc.php
RewriteRule ^contact_([0-9]+).html$ contact.php?ord=$1
RewriteRule ^search.html$ search.php
RewriteRule ^download.html$ down.php
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
RewriteRule .*

转换成 nginx的伪静态规则是这样的

location / {
rewrite "^/index\.html$" /index.php last;
rewrite "^/about_([0-9]+)\.html$" /about.php?id=$1 last;
rewrite "^/product_([0-9]+)_([0-9]+)\.html$" /products.php?clasid=$1&id=$2 last;
rewrite "^/products_([0-9]+)\.html$" /products.php?id=$1 last;
rewrite "^/products\.html$" /products.php last;
rewrite "^/solutions\.html$" /solutions.php last;
rewrite "^/solution_([0-9]+)\.html$" /solutions.php?id=$1 last;
rewrite "^/case\.html$" /case.php last;
rewrite "^/case_([0-9]+)\.html$" /case.php?pages=$1 last;
rewrite "^/case_([0-9]+)_([0-9]+)\.html$" /case.php?clasid=$1&id=$2 last;
rewrite "^/news\.html$" /news.php last;
rewrite "^/news_([0-9]+)\.html$" /news.php?pages=$1 last;
rewrite "^/news_([0-9]+)_([0-9]+)\.html$" /news.php?clasid=$1&id=$2 last;
rewrite "^/epc\.html$" /epc.php last;
rewrite "^/contact_([0-9]+)\.html$" /contact.php?ord=$1 last;
rewrite "^/search\.html$" /search.php last;
rewrite "^/download\.html$" /down.php last;
}

在线转换的网址是这个: http://www.anilcetin.com/convert-apache-htaccess-to-nginx/

本文地址官网    新乡网站建设,seo

分享到:更多 ()
a