`
blueram
  • 浏览: 757435 次
  • 性别: Icon_minigender_1
  • 来自: 郑州
社区版块
存档分类
最新评论

PHPCMS伪静态设置方法小结

阅读更多

1.IIS 下伪静态设置

 

 

首先请下载以下附件IIS Rewrite模块 附件:点击下载

其中httpd.ini为配置文件内容如下:

 

[ISAPI_Rewrite]

# 3600 = 1 hour
CacheClockRate 3600

RepeatLimit 32

# Protect httpd.ini and httpd.parse.errors files
# from accessing through HTTP

# Rewrite 系统规则请勿修改 PHPCMS3.0
RewriteRule ^(.*)/show-([0-9]+)-([0-9]+)/.html$ $1/show/.php/?itemid=$2&page=$3 
RewriteRule ^(.*)/list-([0-9]+)-([0-9]+)/.html$ $1/list/.php/?catid=$2&page=$3 
RewriteRule ^(.*)/show-([0-9]+)/.html$ $1/show/.php/?specialid=$2

 将其解压到任意目录,如: C:/Rewrite

打开“控制面板→管理工具→IIS信息服务管理器→网站→您的站点→属性”。在“ISAPI筛选器”项点击 “添加”, 筛选器名称填入Rewrite,可执行文件为C:/Rewrite/Rewrite.dll (如果您解压到其它目录请填入相应地址)

 

 

 

 

 

 

2.Apache 下伪静态设置

 

Apache下伪静态设置

请首先咨询您的空间服务商,空间是否支持 Rewrite 以及是否支持对站点目录中 .htaccess 的文件解析,否则即便按照下面的方法设置好了,也无法使用。(需要服务器支持Apache的Mod_Rewrite功能)

服务器端设置 rewrite:

 

1、虚拟主机用户:

 

 

在主目录里面需要添加代码 AllowOverride Options FileInfo

 

 

 

取消 LoadModule rewrite_module modules/mod_rewrite.so前面的 #;重新启动Apache.

  1. Apache Web Server(独立主机用户):
  2. 首先确定您使用的 Apache 版本,及是否加载了 mod_rewrite 模块。
  3.  

         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)中加入如下代码。此时请务必注意,如果网站使用通过虚拟主机来定义,请务必加到虚拟主机配置,即 <VirtualHost> 中去,如果加在虚拟主机配置外部将可能无法使用。改好后然后将 Apache 重启。

     <IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^(.*)show-([0-9]+)-([0-9]+)/.html$ $1/show.php?itemid=$2&page=$3 RewriteRule ^(.*)list-([0-9]+)-([0-9]+)/.html$ $1/list.php?catid=$2&page=$3 RewriteRule ^(.*)show-([0-9]+)/.html$ $1/show.php?specialid=$2 </IfModule>

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

    将以下代码保存为.htaccess 并上传到网站目

     

     

  4.  # 将 RewriteEngine 模式打开 RewriteEngine On # 修改以下语句中的 / 为你的网站目录地址,如果程序放在二级目录中,如/phpcms 请将 / 修改为 /phpcms RewriteBase / # Rewrite 系统规则请勿修改 RewriteRule ^(.*)show-([0-9]+)-([0-9]+)/.html$ $1/show.php?itemid=$2&page=$3 RewriteRule ^(.*)list-([0-9]+)-([0-9]+)/.html$ $1/list.php?catid=$2&page=$3 RewriteRule ^(.*)show-([0-9]+)/.html$ $1/show.php?specialid=$2
  5. 设置频道的生成方式:
    某频道下---频道参数设置--生成方式

     

 

  • 大小: 19.3 KB
  • 大小: 22.5 KB
  • 大小: 14.1 KB
  • 大小: 40 KB
  • 大小: 24.8 KB
  • 大小: 16.3 KB
  • 大小: 15.3 KB
  • 大小: 2.9 KB
  • 大小: 49.1 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics