windows2003下 apache ecshop实现二级域名和URL重写功能
我的域名,服务器空间全是万网的,操作系统windows 2003,服务器是Apache 服务器共分2个步骤。
1.实现二级域名,入blog.xxx.com进入博客,www.xxx.com进入商城,book.xxx.com进入书城。
2.ecshop实现URL重写,伪静态。
*******************************************************************************
一:实现二级域名
*******************************************************************************
1。如上图所示,二级域名就可以成功了。可能还包括xxx.com进入网站主题,那么就新增一个域名解析,主机记录(RR)值为空就可以了。
2.修改本机的hosts文件,如下: C:\WINDOWS\system32\drivers\etc\hosts。如下图操作即可。
*******************************************************************************
二:apache 实现ecshop实现URL重写,伪静态。
*******************************************************************************
1。在 httpd.conf 中搜索 LoadModule rewrite_module,将该行前面的 # 号删除。下图选中的文字便是。LoadModule rewrite_module启用apache的伪静态写入(ecshop如果想启用伪静态必须开启此项)。
其次: httpd.conf文件,分别去掉下面两行文字前面的#号。
#LoadModule vhost_alias_module modules/mod_vhost_alias.so
去掉#意思是启用apache的虚拟主机功能。
#Include conf/extra/httpd-vhosts.conf (如果想启用二级域名入blog.xxx.com进入博客,必须启动此项。)
去掉这一行的#意思是从conf/extra/httpd-vhosts.conf这个文件导入虚拟主机配置。
2.将下列代码出入到httpd.conf底部即可。
<VirtualHost *:80>
ServerAdmin xxx@126.com
DocumentRoot "D:/hltdpath/project/ecshop"
ServerName www.xxxxxx.com
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)/index.html$ $1/index.php
RewriteRule ^(.*)/category$ $1/index.php
RewriteRule ^(.*)/feed-c(+).xml$ $1/feed.php?cat=$2
RewriteRule ^(.*)/feed-b(+).xml$ $1/feed.php?brand=$2
RewriteRule ^(.*)/feed-type([^-]+)\.xml$ $1/feed\.php\?type=$2
RewriteRule ^(.*)/feed.xml$ $1/feed.php
RewriteRule ^(.*)/category-(+)-b(+)-min(+)-max(+)-attr([^-]*)-(+)-(.+)-(+)(.*)\.html$$1/category.php?id=$2&brand=$3&price_min=$4&price_max=$5&filter_attr=$6&page=$7&sort=$8&order=$9
RewriteRule ^(.*)/category-(+)-b(+)-min(+)-max(+)-attr([^-]*)(.*)\.html$ $1/category.php?id=$2&brand=$3&price_min=$4&price_max=$5&filter_attr=$6
RewriteRule ^(.*)/category-(+)-b(+)-(+)-(.+)-(+)(.*)\.html$ $1/category.php?id=$2&brand=$3&page=$4&sort=$5&order=$6
RewriteRule ^(.*)/category-(+)-b(+)-(+)(.*)\.html$ $1/category.php?id=$2&brand=$3&page=$4
RewriteRule ^(.*)/category-(+)-b(+)(.*)\.html$ $1/category.php?id=$2&brand=$3
RewriteRule ^(.*)/category-(+)(.*)\.html$ $1/category.php?id=$2
RewriteRule ^(.*)/goods-(+)(.*)\.html$ $1/goods.php?id=$2
RewriteRule ^(.*)/article_cat-(+)-(+)-(.+)-(+)(.*)\.html$$1/article_cat.php?id=$2&page=$3&sort=$4&order=$5
RewriteRule ^(.*)/article_cat-(+)-(+)-(.+)(.*)\.html$ $1/article_cat\.php\?id=$1&page=$2&keywords=$3
RewriteRule ^(.*)/article_cat-(+)-(+)(.*)\.html$ $1/article_cat.php?id=$2&page=$3
RewriteRule ^(.*)/article_cat-(+)(.*)\.html$ $1/article_cat.php?id=$2
RewriteRule ^(.*)/article-(+)(.*)\.html$ $1/article.php?id=$2
RewriteRule ^(.*)/brand-(+)-c(+)-(+)-(.+)-(+)\.html $1/brand.php?id=$2&cat=$3&page=$4&sort=$5&order=$6
RewriteRule ^(.*)/brand-(+)-c(+)-(+)(.*)\.html $1/brand.php?id=$2&cat=$3&page=$4
RewriteRule ^(.*)/brand-(+)-c(+)(.*)\.html $1/brand.php?id=$2&cat=$3
RewriteRule ^(.*)/brand-(+)(.*)\.html $1/brand.php?id=$2
RewriteRule ^(.*)/tag-(.*)\.html $1/search.php?keywords=$2
RewriteRule ^(.*)/snatch-(+)\.html$ $1/snatch.php?id=$2
RewriteRule ^(.*)/group_buy-(+)\.html$ $1/group_buy.php?act=view&id=$2
RewriteRule ^(.*)/auction-(+)\.html$ $1/auction.php?act=view&id=$2
RewriteRule ^(.*)/exchange-id(+)(.*)\.html$ $1/exchange\.php\?id=$2&act=view
RewriteRule ^(.*)/exchange-(+)-min(+)-max(+)-(+)-(.+)-(+)(.*)\.html$ $1/exchange\.php\?cat_id=$2&integral_min=$3&integral_max=$4&page=$5&sort=$6&order=$7
RewriteRule ^(.*)/exchange-(+)-(+)-(.+)-(+)(.*)\.html$ $1/exchange\.php\?cat_id=$2&page=$3&sort=$4&order=$5
RewriteRule ^(.*)/exchange-(+)-(+)(.*)\.html$ $1/exchange\.php\?cat_id=$2&page=$3
RewriteRule ^(.*)/exchange-(+)(.*)\.html$ $1/exchange\.php\?cat_id=$2
</IfModule>
</VirtualHost>
3、ServerName www.xxxxxx.com,红色部分替换成你自己的域名, DocumentRoot "D:/hltdpath/project/ecshop",红色替换成你的项目地址,保存 httpd.conf。
4、将 ecshop 目录下的 htaccess.txt 重命名为 .htaccess。
5、重新启动 Apache。
6、进入 ecshop 管理中心->商店设置,将 URL 重写设置为启用。
最后大功告成了啊!
以上内容同时参考了http://blog.sina.com.cn/s/blog_74c4720501014b0s.html内容,作为感谢了吧!
页:
[1]