url重写:
1.修改apache;
2.在网站的根目录添加一个.htaccess文件,url重写规则写在该文件里面;
RewriteEngine On
# 修改以下语句中的 / 为你的论坛目录地址,如果程序放在bbs中,请将 / 修改为 /bbs
RewriteBase /
#下面添加规则,不同的系统的规则各不相同。
RewriteRule ^(.*)-htm-(.*)$ $1.php?$2
RewriteRule ^(.*)simple/([a-z0-9\_]+\.html)$
$1/simple/index.php?$2
以下给出当前比较流行的phpwind,discuz,shopex三种系统的静态化流程:
1.PHPWind论坛:
新建一个文本文件: new.htaccess 输入以下文字:
RewriteEngine On
# 修改以下语句中的 / 为你的论坛目录地址,如果程序放在bbs中,请将 / 修改为 /bbs
RewriteBase /
RewriteRule ^(.*)-htm-(.*)$ $1.php?$2
RewriteRule ^(.*)simple/([a-z0-9\_]+\.html)$
$1/simple/index.php?$2
把这个文件上传至虚拟主机的wwwroot目录,并改名为:.htaccess,
改名后它会自动隐藏不显示出来,但不影响使用!
上传后请在在论坛管理后台的静态目录部署把静态目录部署功能开启 及把静态目录设置为-htm- ,静态目录扩展名设置为.html
2.discuz论坛
新建一个文本文件: new.htaccess 输入以下文字:
# 将 RewriteEngine 模式打开
RewriteEngine On
RewriteBase /
# Rewrite 系统规则请勿修改
#discuz
RewriteRule ^(.*)/archiver/([a-z0-9\-]+\.html)$
$1/archiver/index\.php\?$2
RewriteRule ^(.*)/forum-([0-9]+)-([0-9]+)\.html$
$1/forumdisplay\.php\?fid=$2&page=$3
RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$
$1/viewthread\.php\?tid=$2&extra=page\=$4&page=$3
RewriteRule ^(.*)/profile-(username|uid)-(.+)\.html$
$1/viewpro\.php\?$2=$3
RewriteRule ^(.*)-htm-(.*)$ $1.php?$2
RewriteRule ^(.*)simple/([a-z0-9\_]+\.html)$
$1/simple/index.php?$2
RewriteRule ^(.*)/archiver/((fid|tid)-[\w\-]+\.html)\?*(.*)$
$1/archiver/index\.php\?$2&$4
RewriteRule ^(.*)/forum-([0-9]+)-([0-9]+)\.html\?*(.*)$
$1/forumdisplay\.php\?fid=$2&page=$3&$4
RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html\?*(.*)$
$1/viewthread\.php\?tid=$2&extra=page\=$4&page=$3&$4
RewriteRule ^(.*)/space-(username|uid)-(.+)\.html\?*(.*)$
$1/space\.php\?$2=$3&$4
RewriteRule ^(.*)/tag-(.+)\.html\?*(.*)$
$1/tag\.php\?name=$2&$3
把这个文件上传至虚拟主机的wwwroot目录,并改名为:.htaccess。然后进入论坛系统设置的搜索引擎优化,根据需要开启
URL 静态化功能。
3.shopex网店
新建一个文本文件:new.htaccess 输入以下文字:
RewriteEngine on
# 修改以下语句中的 / 为你的商店目录地址,如果程序放在子目录中,请将 / 修改为 /子目录
RewriteBase /
#首页
RewriteRule ^/$ index.php [L]
RewriteRule ^index\.html$ index.php [L]
RewriteRule ^default\.html$ index.php [L]
#商店公告
RewriteRule ^bulletin\.html$
index.php?gOo=article_list.dwt&acat=1 [L]
RewriteRule ^bulletin_([0-9]+)\.html$
index.php?gOo=article_list.dwt&acat=1&p=$1
[L]
#商品分类
RewriteRule ^catalog\.html$ index.php?gOo=goods_category.dwt
[L]
#全部商品
RewriteRule ^list\.html$ index.php?gOo=goods_search_list.dwt
[L]
RewriteRule ^list_([0-9]+)\.html$
index.php?gOo=goods_search_list.dwt&p=$1 [L]
#会员中心
RewriteRule ^member\.html$ index.php?gOo=member_home.dwt [L]
#帮助中心与常见问题
RewriteRule ^faq\.html$
index.php?gOo=help.dwt&acat=2 [L]
RewriteRule ^faq_([0-9]+)\.html$
index.php?gOo=help.dwt&acat=2&p=$1
[L]
#安全交易
RewriteRule ^safe\.html$ index.php?gOo=help_safe.dwt [L]
#购买流程
RewriteRule ^howtobuy\.html$ index.php?gOo=help_buystep.dwt
[L]
#如何付款
RewriteRule ^howtopay\.html$ index.php?gOo=help_send.dwt [L]
#联系我们
RewriteRule ^contactus\.html$ index.php?gOo=help_contact.dwt
[L]
#关于我们
RewriteRule ^aboutus\.html$ index.php?gOo=help_copyright.dwt
[L]
#顾客留言分页
RewriteRule ^feedback_([0-9]+)\.html$
index.php?gOo=shopbbs.dwt&p=$1 [L]
#顾客留言
RewriteRule ^feedback\.html$ index.php?gOo=shopbbs.dwt [L]
#友情链接
RewriteRule ^friendlink\.html$ index.php?gOo=linkmore.dwt [L]
#用户注册
RewriteRule ^register\.html$ index.php?gOo=register_1.dwt [L]
#忘记密码
RewriteRule ^lostpass\.html$ index.php?gOo=forget.dwt [L]
#商品详细页
RewriteRule ^product/([0-9]+)\.html$
index.php?gOo=goods_details.dwt&goodsid=$1
[L]
RewriteRule ^product_([0-9]+)\.html$
index.php?gOo=goods_details.dwt&goodsid=$1
[L]
RewriteRule ^([0-9]+)_([^.]*)\.html$
index.php?gOo=goods_details.dwt&goodsid=$1
[L]
#新闻详细页
RewriteRule ^article_([0-9]+)\.html$
index.php?gOo=help_details.dwt&articleid=$1
[L]
RewriteRule ^message_([0-9]+)\.html$
index.php?gOo=article_details.dwt&articleid=$1
[L]
#分类详细列表
RewriteRule ^catalog_([0-9]+)\.html$
index.php?gOo=goods_search_list.dwt&gcat=$1
[L]
RewriteRule ^catalog_([0-9]+)_([0-9]+)\.html$
index.php?gOo=goods_search_list.dwt&gcat=$1&p=$2
[L]
#收藏商品
RewriteRule ^addtofavorites_([0-9]+)\.html$
index.php?gOo=addmembergoods.do&goodsid=$1
[L]
#首页上的最新,推荐,特价商品
RewriteRule ^list_([a-zA-Z]+)\.html$
index.php?gOo=goods_search_list.dwt>ype=$1
[L]
RewriteRule ^list_([a-zA-Z]+)_([0-9]+)\.html$
index.php?gOo=goods_search_list.dwt>ype=$1&p=$2
[L]
把这个文件上传至虚拟主机的wwwroot目录,并改名为:.htaccess
然后请进入管理后台>商店推广>搜索优化>静态优先,选中“开启静态优化
开启Url Rewrite引擎 并在URL上针对搜索引擎进行细致的优化”,保存即可。
4. ECshop商城:
新建一个文本文件: new.htaccess 输入以下文字:
"\.(bak|inc|lib|sh|tpl|lbi|dwt)$">
order
deny,allow
deny from
all
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.xml$ feed.php [L]
RewriteRule
^category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$
category.php?id=$1&brand=$2&price_min=$3&price_max=$4&filter_attr=$5&page=$6&sort=$7&order=$8
[QSA,L]
RewriteRule
^category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)(.*)\.html$ category.php?id=$1&brand=$2&price_min=$3&price_max=$4&filter_attr=$5
[QSA,L]
RewriteRule
^category-([0-9]+)-b([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$ category.php?id=$1&brand=$2&page=$3&sort=$4&order=$5
[QSA,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$