1. 确保你的apache 已经开启了url 重写模块。
将http.conf 里的 LoadModulerewrite_module modules/mod_rewrite.so 开启。
将 http.conf <Directory /> 根容器里的 AllowOverride设为All。
(有下级容器的,也要设置为All。例:<Directory "d:/web/">)
若设置了虚拟主机,也需将 httpd-vhosts.conf里相应的虚拟主机配置里的 AllowOverride 的值 设置为All。即“AllowOverride All”;
2.将以下代码复制到记事本中,另存为.htaccess文件,然后放到该网站根目录。
RewriteEngine On
# define the rewrite url work area.
RewriteBase /
# The following rule tells Apache that
RewriteRule^content-([0-9]+)-([0-9]+)-([0-9]+).html$index.php?m=content&c=index&a=show&catid=$1&id=$2&page=$3
RewriteRule^show-([0-9]+)-([0-9]+)-([0-9]+).html$index.php?m=content&c=index&a=show&catid=$1&id=$2&page=$3
RewriteRule ^list-([0-9]+)-([0-9]+).html$index.php?m=content&c=index&a=lists&catid=$1&page=$2
3.进入网站后台-->内容-->管理栏目选择要应用规则的栏目,点击修改,在生成html设置栏目下的“栏目页/内容页url规则”选择.htaccess文件里定义的规则,提交并更新缓存。
(在扩展-->url规则管理可以添加各种规则,给步骤3选择。)