一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

Phpcms2008 企业黄页伪静态规则[apache,iis,apache虚拟主机]

时间:2009-07-21 编辑:简简单单 来源:一聚教程网

Phpcms2008 企业黄页伪静态规则 Apache Web Server(虚拟主机用户)

# 将 RewriteEngine 模式打开
 RewriteEngine On
 RewriteBase /yp

 # Rewrite 系统规则请勿修改
RewriteRule ^job-list-([0-9]+)-([0-9]+)-(.+).html$ job.php?action=list&inputtime=$1&station=$2&genre=$3
RewriteRule ^([a-z]+)-([0-9]+).html$ $1.php?action=show&id=$2
RewriteRule ^product-list-([0-9]+)-([0-9]+)-([0-9]+)--(.+)--([0-1]).html$ product.php?view_type=$1&catid=$2&pagesize=$3&areaname=$4&order=$5
RewriteRule ^product-list-([0-9]+)-([0-9]+)-([0-9]+)--(.+)--([0-1])-([0-9]+).html$ product.php?view_type=$1&catid=$2&pagesize=$3&areaname=$4&order=$5&page=$6
RewriteRule ^([a-z]+)-list-([0-9]+).html$ $1.php?action=list&catid=$2
RewriteRule ^show-([0-9]+)-([a-z]+)-([0-9]+).html$ web/show.php?userid-$1/category-$2/id-$3.html

Phpcms2008 企业黄页伪静态规则 IIS Web Server(独立主机用户)


首先在 IIS 的 Isapi 上添加这个筛选器,筛选器名称为 Rewrite ,可执行文件选择 Rewrite.dll ,重新启动 IIS。附件中 httpd.ini 已经设置好,其中内容如下:

 

 [ISAPI_Rewrite]

 # 3600 = 1 hour
 CacheClockRate 3600

 RepeatLimit 32

 # Protect httpd.ini and httpd.parse.errors files
 # from accessing through HTTP
RewriteRule ^(.*)/job-list-([0-9]+)-([0-9]+)-(.+).html$ $1/job.php?action=list&inputtime=$2&station=$3&genre=$4RewriteRule ^(.*)/([a-z]+)-([0-9]+).html$ $1/$2.php?action=show&id=$3RewriteRule ^(.*)/product-list-([0-9]+)-([0-9]+)-([0-9]+)--(.+)--([0-1]).html$ $1/product.php?view_type=$2&catid=$3&pagesize=$4&areaname=$5&order=$6RewriteRule ^(.*)/product-list-([0-9]+)-([0-9]+)-([0-9]+)--(.+)--([0-1])-([0-9]+).html$ $1/product.php?view_type=$2&catid=$3&pagesize=$4&areaname=$5&order=$6&page=$7 RewriteRule ^(.*)/([a-z]+)-list-([0-9]+).html$ $1/$2.php?action=list&catid=$3
RewriteRule ^(.*)/show-([0-9]+)-([a-z]+)-([0-9]+).html$ $1/web/show.php?userid-$2/category-$3/id-$4.html

Phpcms2008企业黄页伪静态规则 Apache Web Server(独立主机用户)

首先确定您使用的 Apache 版本,及是否加载了 mod_rewrite 模块。
Apache 1.x 的用户请检查 conf/httpd.conf 中是否存在如下两段代码:
LoadModule rewrite_module     libexec/mod_rewrite.so
AddModule mod_rewrite.c

Apache 2.x 的用户请检查 conf/httpd.conf 中是否存在如下一段代码:

LoadModule rewrite_module     modules/mod_rewrite.so
如果存在,那么在配置文件(通常就是 conf/httpd.conf)中加入如下代码。此时请务必注意,如果网站使用通过虚拟主机来定义,请务必加到虚拟主机配置,即 中去,如果加在虚拟主机配置外部将可能无法使用。改好后然后将 Apache 重启。


RewriteEngine On
RewriteRule ^(.*)/job-list-([0-9]+)-([0-9]+)-(.+).html$ $1/job.php?action=list&inputtime=$2&station=$3&genre=$4
RewriteRule ^(.*)/([a-z]+)-([0-9]+).html$ $1/$2.php?action=show&id=$3
RewriteRule ^(.*)/product-list-([0-9]+)-([0-9]+)-([0-9]+)--(.+)--([0-1]).html$ $1/product.php?view_type=$2&catid=$3&pagesize=$4&areaname=$5&order=$6
RewriteRule ^(.*)/product-list-([0-9]+)-([0-9]+)-([0-9]+)--(.+)--([0-1])-([0-9]+).html$ $1/product.php?view_type=$2&catid=$3&pagesize=$4&areaname=$5&order=$6&page=$7
RewriteRule ^(.*)/([a-z]+)-list-([0-9]+).html$ $1/$2.php?action=list&catid=$3
RewriteRule ^(.*)/show-([0-9]+)-([a-z]+)-([0-9]+).html$ $1/web/show.php?userid-$2/category-$3/id-$4.html

如果没有安装 mod_rewrite,您可以重新编译 Apache,并在原有 configure 的内容中加入 --enable-rewrite=shared,然后再在 Apache 配置文件中加入上述代码即可。

热门栏目