ecshop中iis/apache伪静态规则配置示例
发布:smiling 来源: PHP粉丝网 添加日期:2014-11-28 10:58:26 浏览: 评论:0
伪静态是现在网站建设技术中一门高常用的技术了,我们可以利用伪静态来实现网站像php一样更新全部自动更新,修改模板所有页面一并修改了,下文我们一起来看看ecshop中iis/apache伪静态规则配置示例.
apache下的伪静态规则范例
复制下面这段代码,然后存为 .htaccess 放到站点的根目录下面就行了,请确保您的空间/服务器是安装的apache,如果是iis,请参考代潇瑞博客中的 ecshop在iis下的伪静态规则范例,代码如下:
- <FilesMatch "\.(bak|inc|lib|sh|tpl|lbi|dwt)$">
- order deny,allow
- deny from all
- </FilesMatch>
- RewriteEngine On
- RewriteBase /
- # direct one-word access
- RewriteRule ^index\.html$ index\.php [L]
- RewriteRule ^category$ index\.php [L]
- # access any object by its numeric identifier
- RewriteRule ^feed-c([0-9]+)\.xml$ feed\.php\?cat=$1 [L]
- RewriteRule ^feed-b([0-9]+)\.xml$ feed\.php\?brand=$1 [L]
- RewriteRule ^feed-type([^-]+)\.xml$ feed\.php\?type=$1 [L]
- RewriteRule ^feed\.xml$ feed\.php [L]
- RewriteRule ^category-([0-9]+)-b([0-9]+)-([0-9]+)(.*)\.html$ category\.php\?id=$1&brand=$2&page=$3 [QSA,L]
- RewriteRule ^category-([0-9]+)-b([0-9]+)(.*)\.html$ category\.php\?id=$1&brand=$2 [QSA,L]
- RewriteRule ^category-([0-9]+)(.*)\.html$ category\.php\?id=$1 [QSA,L]
- RewriteRule ^goods-([0-9a-zA-Z_]+)-([0-9]+)(.*)\.html$ goods\.php\?id=$2 [QSA,L]
- RewriteRule ^goods-([0-9]+)(.*)\.html$ goods\.php\?id=$1 [QSA,L]
- RewriteRule ^article_cat-([0-9]+)-([0-9]+)(.*)\.html$ article_cat\.php\?id=$1&page=$2 [QSA,L]
- RewriteRule ^article_cat-([0-9]+)(.*)\.html$ article_cat\.php\?id=$1 [QSA,L]
- RewriteRule ^article-([0-9]+)(.*)\.html$ article\.php\?id=$1 [QSA,L]
- RewriteRule ^brand-([0-9]+)-c([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)\.html brand\.php\?id=$1&cat=$2&page=$3&sort=$4&order=$5 [QSA,L]
- RewriteRule ^brand-([0-9]+)-c([0-9]+)-([0-9]+)(.*)\.html brand\.php\?id=$1&cat=$2&page=$3 [QSA,L]
- RewriteRule ^brand-([0-9]+)-c([0-9]+)(.*)\.html brand\.php\?id=$1&cat=$2 [QSA,L]
- RewriteRule ^brand-([0-9]+)(.*)\.html brand\.php\?id=$1 [QSA,L]
- RewriteRule ^tag-(.*)\.html search\.php\?keywords=$1 [QSA,L]
- RewriteRule ^snatch-([0-9]+)\.html$ snatch\.php\?id=$1 [QSA,L]
- RewriteRule ^group_buy-([0-9]+)\.html$ group_buy\.php\?act=view&id=$1 [QSA,L]
- RewriteRule ^auction-([0-9]+)\.html$ auction\.php\?act=view&id=$1 [QSA,L]
iis下的伪静态规则范例
复制下面的代码,存为 web.config 放到站点的根目录下面就行了,请确保您的空间/服务器是安装的iis,如果是apache,请参考代潇瑞博客中的 ecshop在apache下的伪静态规则范例,代码如下:
- <?xml version="1.0" encoding="UTF-8"?>
- <configuration>
- <system.webServer>
- <rewrite>
- <rules>
- <rule name="index">
- <match url="^index.html" />
- <action type="Rewrite" url="index.php" />
- </rule>
- <rule name="category">
- <match url="^(.*/)*category.html" />
- <action type="Rewrite" url="{R:1}/category.php" />
- </rule>
- <rule name="category0">
- <match url="^(.*/)*category-([0-9]+).html" />
- <action type="Rewrite" url="{R:1}/category.php\?id={R:2}" />
- </rule>
- <rule name="category1">
- <match url="^(.*/)*category-([0-9]+)-([0-9]+)-(\w+).html" />
- <action type="Rewrite" url="{R:1}/category.php\?id={R:2}&page={R:3}" />
- </rule>
- <rule name="brands">
- <match url="^(.*/)*brands-([0-9]+).html" />
- <action type="Rewrite" url="{R:1}/brands.php\?id={R:2}" />
- </rule>
- <rule name="article">
- <match url="^(.*/)*article-([0-9]+).html" />
- <action type="Rewrite" url="{R:1}/article.php\?id={R:2}" />
- </rule>
- <rule name="article_cat">
- <match url="^(.*/)*article_cat-([0-9]+).html" />
- <action type="Rewrite" url="{R:1}/article_cat.php\?id={R:2}" />
- </rule>
- <rule name="article_cat_page">
- <match url="^(.*/)*article_cat-([0-9]+)-([0-9]+).html" />
- <action type="Rewrite" url="{R:1}/article_cat.php\?id={R:2}&page={R:3}" />
- </rule>
- <rule name="goods">
- <match url="^(.*/)*goods-([0-9]+).html" />
- <action type="Rewrite" url="{R:1}/goods.php\?id={R:2}" />
- </rule>
- <rule name="contact">
- <match url="^(.*/)*contact.html" />
- <action type="Rewrite" url="{R:1}/contact.php" />
- </rule>
- <rule name="search">
- <match url="^(.*/)*search-([a-zA-Z]+).html" />
- <action type="Rewrite" url="{R:1}/search.php\?intro={R:2}" />
- </rule>
- <rule name="maps">
- <match url="^(.*/)*maps.html" />
- <action type="Rewrite" url="{R:1}/maps.php" />
- </rule>//开源软件:phpfensi.com
- </rules>
- </rewrite>
- </system.webServer>
- </configuration>
Tags: ecshop静态规则 apache伪静态
推荐文章
热门文章
最新评论文章
- 写给考虑创业的年轻程序员(10)
- PHP新手上路(一)(7)
- 惹恼程序员的十件事(5)
- PHP邮件发送例子,已测试成功(5)
- 致初学者:PHP比ASP优秀的七个理由(4)
- PHP会被淘汰吗?(4)
- PHP新手上路(四)(4)
- 如何去学习PHP?(2)
- 简单入门级php分页代码(2)
- php中邮箱email 电话等格式的验证(2)