易企CMS伪静态(URL重写)包含Apache IIS和nginx
本文最后更新于2021年11月9日,已超过1107天没有更新,若内容或图片失效,请留言反馈。
Apache
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^article\/(.+)\.html$ article.php?name=$1 [L]
RewriteRule ^product\/(.+)\.html$ product.php?name=$1 [L]
RewriteRule ^category\/([^/_]+)[/]?$ category.php?name=$1 [L]
RewriteRule ^category\/([^/]+)_([0-9]+)[/]?$ category.php?name=$1&p=$2 [L]
RewriteRule ^catalog\/([^/]+)[/]?$ catalog.php?type=$1 [L]
RewriteRule ^comment.html$ comment.php [L]
RewriteRule ^sitemap.xml$ sitemap.php [L]
</IfModule>
IIS
RewriteRule ^/article/(.+)\.html$ /article\.php\?name=$1
RewriteRule ^/product/(.+)\.html$ /product\.php\?name=$1
RewriteRule ^/category/([^/_]+)[/]?$ /category\.php\?name=$1
RewriteRule ^/category/([^/]+)_([0-9]+)[/]?$ /category\.php\?name=$1&p=$2
RewriteRule ^/catalog/([^/]+)[/]?$ /catalog\.php\?type=$1
RewriteRule ^/comment\.html$ /comment\.php
RewriteRule ^/sitemap\.xml$ /sitemap\.php
nginx
rewrite ^/article\/(.+)\.html$ /article.php?name=$1 last;
rewrite ^/product\/(.+)\.html /product.php?name=$1 last;
rewrite ^/category\/([^/]+)_([0-9]+)[/]? /category.php?name=$1&p=$2 last;
rewrite ^/category\/([^/_]+)[/]? /category.php?name=$1 last;
rewrite ^/catalog\/([^/]+)[/]? /catalog.php?type=$1 last;
rewrite ^/comment.html$ /comment.php last;
rewrite ^/sitemap.xml$ /sitemap.php last;
评论已关闭