ecshop伪静态的实现技巧-高手飘过

2016-07-07 15:18 来源:www.chinab4c.com 作者:ecshop专家

这里给大家共享的是两种不同的主机实现ecshop伪静态的方法,我们要先知道自己的虚拟主机是Apache 服务器 还是 IIS 服务器 ,进入ecshop后台就会看见你的服务器是什么。如果你虚拟主机是Apache,通过 httpd.conf 来设置重写规则:

就是新建一个httpd.conf 然后把它上传到ec安装目录下,并把htaccess.txt 重命名为 .htaccessd。
需要先找到 Apache 安装目录(虚拟主机,找到ecshop安装目录下即可),之后找到conf目录下的 httpd.conf 文件。
2.我们把下面的代码复制到 httpd.conf 文件中, /ecshop 替换为商店的实际安装目录。

<Directory /ecshop>
Options FollowSymLinks
AllowOverride All
</Directory>

3、在 httpd.conf 中找到 LoadModule rewrite_module,将该行前面的 # 号删除。
Apache1.3.x 需要查找 AddModule mod_rewrite.c,并将前面的#也删除。

找到代码,如:
<VirtualHost 127.0.0.1>
DocumentRoot “/home/ecshop/”
ServerName www.ecshop.com
</VirtualHost>//商店所在的虚拟主机代码段

4、将代码1的内容加入在</VirtualHost>之前,在结尾会给大家列出。

或者还有一个方法实现ecshop伪静态,
先执行上述的1-3步,
然后保存 httpd.conf。
将 ecshop 目录下的 htaccess.txt 重命名为 .htaccess。
重新启动 Apache。
进入 ecshop 管理中心->商店设置->基本设置,将 URL 重写设置为简单重写,就能实现ecshop伪静态了。

如果你的主机是IIS 服务器。

span style=”color: #0000ff;”>1、首先下载免费版的ISAPI_Rewrite组件:
ISAPI_Rewrite Lite ( freeware )。如果您是商业应用建议您购买完整版的 ISAPI_Rewrite Full。如果您无法访问以上网址,您也可以下载:http://www.ecshop.com2、文件isapi_rwl_x86_0064.msi 进行安装,成功之后(默认在C:/Program Files/Helicon/ISAPI_Rewrite)找到httpd.ini文件,点击右键将文件只读属性去掉。
然后,开始菜单->程序->Helicon->ISAPI_Rewrite->httpd.ini,点击打开 httpd.ini 文件。
3、复制下面的内容到httpd.ini文件
4、保存 httpd.ini,进入 ecshop 管理中心->商店设置->基本设置,将 URL 重写设置为简单重写。把代码2(文章最后会给出代码2)复制到httpd.ini文件,然后上传到EC安装目录,即可。
虚拟主机是Apache 服务器 或者 IIS 服务器的ecshop伪静态现在我们都学会了,希望那个能够帮到大家。
文章转自http://www.ecshopmoban.cn/article.php?id=322

代码1:
[ISAPI_Rewrite]

# 为了确保重写规则不影响服务器上的其他站点
# 请将下面的语句前的#号去掉,并将(?:www\.)?site1\.com改为商店所在域名

#RewriteCond %{HTTP:Host} (?:www\.)?site1\.com

RewriteRule ^(.*)/index.html$ $1/index\.php [I]
RewriteRule ^(.*)/category$ $1/index\.php [I]
RewriteRule ^(.*)/feed-c([0-9]+).xml$ $1/feed\.php\?cat=$2 [I]
RewriteRule ^(.*)/feed-b([0-9]+).xml$ $1/feed\.php\?brand=$2 [I]
RewriteRule ^(.*)/feed-type([^-]+)\.xml$ $1/feed\.php\?type=$2 [I]
RewriteRule ^(.*)/feed.xml$ $1/feed\.php [I]
RewriteRule ^(.*)/category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$ $1/category\.php\?id=$2&brand=$3&price_min=$4&price_max=$5&filter_attr=$6&page=$7&sort=$8&order=$9 [I]
RewriteRule ^(.*)/category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)\.html$ $1/category\.php\?id=$2&brand=$3&price_min=$4&price_max=$5&filter_attr=$6 [I]
RewriteRule ^(.*)/category-([0-9]+)-b([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$ $1/category\.php\?id=$2&brand=$3&page=$4&sort=$5&order=$6 [I]
RewriteRule ^(.*)/category-([0-9]+)-b([0-9]+)-([0-9]+)(.*)\.html$ $1/category\.php\?id=$2&brand=$3&page=$4 [I]
RewriteRule ^(.*)/category-([0-9]+)-b([0-9]+)(.*)\.html$ $1/category\.php\?id=$2&brand=$3 [I]
RewriteRule ^(.*)/category-([0-9]+)(.*)\.html$ $1/category\.php\?id=$2 [I]

RewriteRule ^(.*)/category-([0-9]+)-b([0-9]+)\.html(.*)$ $1/category\.php\?$4&id=$2&brand=$3

RewriteRule ^(.*)/goods-([0-9]+)(.*)\.html$ $1/goods\.php\?id=$2 [I]
RewriteRule ^(.*)/article_cat-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$ $1/article_cat\.php\?id=$2&page=$3&sort=$4&order=$5 [I]
RewriteRule ^(.*)/article_cat-([0-9]+)-([0-9]+)(.*)\.html$ $1/article_cat\.php\?id=$2&page=$3 [I]
RewriteRule ^(.*)/article_cat-([0-9]+)(.*)\.html$ $1/article_cat\.php\?id=$2 [I]
RewriteRule ^(.*)/article-([0-9]+)(.*)\.html$ $1/article\.php\?id=$2 [I]
RewriteRule ^(.*)/brand-([0-9]+)-c([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)\.html $1/brand\.php\?id=$2&cat=$3&page=$4&sort=$5&order=$6 [I]
RewriteRule ^(.*)/brand-([0-9]+)-c([0-9]+)-([0-9]+)(.*)\.html $1/brand\.php\?id=$2&cat=$3&page=$4 [I]

RewriteRule ^(.*)/brand-([0-9]+)-c([0-9]+)\.html(.*)$ $1/brand\.php\?$4&id=$2&cat=$3 [I]

RewriteRule ^(.*)/brand-([0-9]+)-c([0-9]+)(.*)\.html $1/brand\.php\?id=$2&cat=$3 [I]
RewriteRule ^(.*)/brand-([0-9]+)(.*)\.html $1/brand\.php\?id=$2 [I]
RewriteRule ^(.*)/tag-(.*)\.html $1/search\.php\?keywords=$2 [I]
RewriteRule ^(.*)/snatch-([0-9]+)\.html$ $1/snatch\.php\?id=$2 [I]
RewriteRule ^(.*)/group_buy-([0-9]+)\.html$ $1/group_buy\.php\?act=view&id=$2 [I]
RewriteRule ^(.*)/auction-([0-9]+)\.html$ $1/auction\.php\?act=view&id=$2 [I]
RewriteRule ^(.*)/exchange-id([0-9]+)(.*)\.html$ $1/exchange\.php\?id=$2&act=view [I]
RewriteRule ^(.*)/exchange-([0-9]+)-min([0-9]+)-max([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$ $1/exchange\.php\?cat_id=$2&integral_min=$3&integral_max=$4&page=$5&sort=$6&order=$7 [I]
RewriteRule ^(.*)/exchange-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$ $1/exchange\.php\?cat_id=$2&page=$3&sort=$4&order=$5 [I]
RewriteRule ^(.*)/exchange-([0-9]+)-([0-9]+)(.*)\.html$ $1/exchange\.php\?cat_id=$2&page=$3 [I]
RewriteRule ^(.*)/exchange-([0-9]+)(.*)\.html$ $1/exchange\.php\?cat_id=$2 [I]



代码2:
01 [ISAPI_Rewrite]
02

03 # 为了确保重写规则不影响服务器上的其他站点

04 # 请将下面的语句前的#号去掉,并将(?:www\.)?site1\.com改为商店所在域名

05

06 #RewriteCond %{HTTP:Host} (?:www\.)?site1\.com

07

08 RewriteRule ^(.*)/index.html$ $1/index\.php [I]

09 RewriteRule ^(.*)/category$ $1/index\.php [I]

10 RewriteRule ^(.*)/feed-c([0-9]+).xml$ $1/feed\.php\?cat=$2 [I]

11 RewriteRule ^(.*)/feed-b([0-9]+).xml$ $1/feed\.php\?brand=$2 [I]

12 RewriteRule ^(.*)/feed-type([^-]+)\.xml$ $1/feed\.php\?type=$2 [I]

13 RewriteRule ^(.*)/feed.xml$ $1/feed\.php [I]

14 RewriteRule ^(.*)/category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$ $1/category\.php\?id=$2&brand=$3&price_min=$4&price_max=$5&filter_attr=$6&page=$7&sort=$8&order=$9 [I]

15 RewriteRule ^(.*)/category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)\.html$ $1/category\.php\?id=$2&brand=$3&price_min=$4&price_max=$5&filter_attr=$6 [I]

16 RewriteRule ^(.*)/category-([0-9]+)-b([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$ $1/category\.php\?id=$2&brand=$3&page=$4&sort=$5&order=$6 [I]

17 RewriteRule ^(.*)/category-([0-9]+)-b([0-9]+)-([0-9]+)(.*)\.html$ $1/category\.php\?id=$2&brand=$3&page=$4 [I]

18 RewriteRule ^(.*)/category-([0-9]+)-b([0-9]+)(.*)\.html$ $1/category\.php\?id=$2&brand=$3 [I]

19 RewriteRule ^(.*)/category-([0-9]+)(.*)\.html$ $1/category\.php\?id=$2 [I]

20

21 RewriteRule ^(.*)/category-([0-9]+)-b([0-9]+)\.html(.*)$ $1/category\.php\?$4&id=$2&brand=$3

22

23 RewriteRule ^(.*)/goods-([0-9]+)(.*)\.html$ $1/goods\.php\?id=$2 [I]

24 RewriteRule ^(.*)/article_cat-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$ $1/article_cat\.php\?id=$2&page=$3&sort=$4&order=$5 [I]

25 RewriteRule ^(.*)/article_cat-([0-9]+)-([0-9]+)(.*)\.html$ $1/article_cat\.php\?id=$2&page=$3 [I]

26 RewriteRule ^(.*)/article_cat-([0-9]+)(.*)\.html$ $1/article_cat\.php\?id=$2 [I]

27 RewriteRule ^(.*)/article-([0-9]+)(.*)\.html$ $1/article\.php\?id=$2 [I]

28 RewriteRule ^(.*)/brand-([0-9]+)-c([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)\.html $1/brand\.php\?id=$2&cat=$3&page=$4&sort=$5&order=$6 [I]

29 RewriteRule ^(.*)/brand-([0-9]+)-c([0-9]+)-([0-9]+)(.*)\.html $1/brand\.php\?id=$2&cat=$3&page=$4 [I]

30

31 RewriteRule ^(.*)/brand-([0-9]+)-c([0-9]+)\.html(.*)$ $1/brand\.php\?$4&id=$2&cat=$3 [I]

32

33 RewriteRule ^(.*)/brand-([0-9]+)-c([0-9]+)(.*)\.html $1/brand\.php\?id=$2&cat=$3 [I]

34 RewriteRule ^(.*)/brand-([0-9]+)(.*)\.html $1/brand\.php\?id=$2 [I]

35 RewriteRule ^(.*)/tag-(.*)\.html $1/search\.php\?keywords=$2 [I]

36 RewriteRule ^(.*)/snatch-([0-9]+)\.html$ $1/snatch\.php\?id=$2 [I]

37 RewriteRule ^(.*)/group_buy-([0-9]+)\.html$ $1/group_buy\.php\?act=view&id=$2 [I]

38 RewriteRule ^(.*)/auction-([0-9]+)\.html$ $1/auction\.php\?act=view&id=$2 [I]

39 RewriteRule ^(.*)/exchange-id([0-9]+)(.*)\.html$ $1/exchange\.php\?id=$2&act=view [I]

40 RewriteRule ^(.*)/exchange-([0-9]+)-min([0-9]+)-max([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$ $1/exchange\.php\?cat_id=$2&integral_min=$3&integral_max=$4&page=$5&sort=$6&order=$7 [I]

41 RewriteRule ^(.*)/exchange-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$ $1/exchange\.php\?cat_id=$2&page=$3&sort=$4&order=$5 [I]

42 RewriteRule ^(.*)/exchange-([0-9]+)-([0-9]+)(.*)\.html$ $1/exchange\.php\?cat_id=$2&page=$3 [I]

43 RewriteRule ^(.*)/exchange-([0-9]+)(.*)\.html$ $1/exchange\.php\?cat_id=$2 [I]

回答:
支持一下


谢谢楼主共享




不谢

好贴都要顶下~~

好帖一个,顶。

谢谢.我的铁观音茶叶网站也可以实现伪静态。
是按你最后一种方法去做的。很容易就好了。

谢谢,我知道了

1、首先下载免费版的ISAPI_Rewrite组件:
ISAPI_Rewrite Lite ( freeware )。如果您是商业应用建议您购买完整版的 ISAPI_Rewrite Full。如果您无法访问以上网址,您也可以下载:http://www.ecshop.com2、文件isapi_rwl_x86_0064.msi 进行安装


下载的ISAPI_Rewrite Lite ( freeware )安装后,提示系统已经安装了,然后又提示在什么结束时出现一个错误,导致安装后找不到httpd.ini文件,请问楼主这个咋解决,谢谢!

留言!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


Not Found

The requested URL /goods-37.html was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Apache/2.0.63 (Win32) PHP/5.2.14 Server at 127.0.0.1 Port 80

很不错、

这个很强,看看好用不