08cms服务器伪静态配置方法

发布时间:2017/2/18 23:13:13

伪静态设置

一、Apache 下伪静态设置

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

VPS用户可以自行设置(需要服务器支持Apache的Mod_Rewrite功能)

1、首先您需要找到 Apache 安装目录,之后找到 conf 目录下的 httpd.conf 文件。

2、将下面的代码复制到 httpd.conf 文件中,注意将 /auto 替换为您的网站的实际安装目录。

<Directory /auto>    

  Options FollowSymLinks   

  AllowOverride All   

</Directory>  

3、在 httpd.conf 中搜索 LoadModule rewrite_module,将该行前面的 # 号删除。 如果您的 Apache 是1.3.x版本还需要查找 AddModule mod_rewrite.c, 请将前面的#删除。

4、保存 httpd.conf。

5、设置您网站的伪静态规则.htacces复制到 auto 根目录下。

6、重新启动 Apache。

二、IIS 服务器

1、首先请进入以下网址 http://www.helicontech.com/download/,下载免费版的 ISAPI_Rewrite组件:ISAPI_Rewrite Lite ( freeware )。如果您仅仅是测试用途使用 这个就足够了,如果您是商业应用建议您购买完整版的 ISAPI_Rewrite Full。

2、点击下载到本地的文件 isapi_rwl_x86_0064.msi (该文件名和您下载的版本有关) 进行安装,安装成功之后进入安装目录(默认在 C:/Program Files/Helicon/ISAPI_Rewrite)找到httpd.ini文件,点击右键将文件只读 属性去掉。然后进入: 开始菜单->程序->Helicon->ISAPI_Rewrite->httpd.ini, 点击打开 httpd.ini 文件,设置您网站的伪静态规则保存即可。

三、 NGINX服务器

1、nginx服务器一般分两种方式,一种是nginx + fastcgi,另一种是nginx + apache(反向代理);
nginx + fastcgi的方式直接在nginx配置文件里配置项:(http -> server) 08cms的主机配置里加入以下代码即可:
include 08cms根目录/.htaccess;
如:08cms安装到目录: /var/www/08cms  路径里,那就加入 include /var/www/08cms/.htaccess; 即可

nginx + apache方式,该方式有两种方法,一种是用nginx使用Rwrite,另一种是代理到apache来使用Rewrite,如果用nginx使用Rwrite的话配置方法与nginx + fastcgi的方式相同,如果代理到apache来使用Rewrite的话那就在配置文件里,把需要做Rewrite的文件后缀也代理过去,如原来是:
location ~ \.php$ {
        proxy_pass   http://127.0.0.1:8081;
    }
那 location ~ \.php$ { 就替换为: location ~ \.(php|htm|html)$ { 即把htm文件与html文件也代理给apache处理(即Rewrite就按apache配置Rewrite方式配置即可),但一般不建议用这种方法,因为nginx处理静态文件还是有一定的优势。



示列:

##
# @package		08CMS
# @copyright	Copyright (C) 2008 - 2013 08CMS, Inc. All rights reserved.
##
        
##
# 使用该文件时请先阅读该内容
# 要使用该文件,请在服务器配置里开启Rewrite模块,具体配置方法请查看:http://www.08cms.com/html/tech/1157-1.html
##
RewriteEngine On

RewriteBase /
RewriteRule ^member/index-htm-(.+)$ member/index.php?$1 [L]
RewriteRule ^mspace/archive-htm-(.+)$ mspace/archive.php?$1 [L]
RewriteRule ^mspace/index-htm-(.+)$ mspace/index.php?$1 [L]
RewriteRule ^wap/login-htm-(.+)$ wap/login.php?$1 [L]
RewriteRule ^index-htm-(.+)$ index.php?$1 [L]
RewriteRule ^archive-htm-(.+)$ archive.php?$1 [L]
RewriteRule ^info-htm-(.+)$ info.php?$1 [L]
RewriteRule ^mobile/index-htm-(.+)$ mobile/index.php?$1 [L]