TinTin
    Moderate
    
商务门户版
Level: 36
HP: 988 / 988
MP: 608 / 954
Exp: 27%
帖子: 913
积分: 2391
注册时间: 2006-01-17
|
SiteEngine Rewrite 设置指南
===============================================
+ Apache Web Server(虚拟主机用户)
===============================================
在开始以下设置之前,请首先咨询您的空间服务商
空间是否支持 Rewrite 以及是否支持对站点目录中 .htaccess 的文件解析
否则即便按照下面的方法设置好了,也无法使用
注意:
以下规则,仅适用于程序可以通过独立域名或者二级域名直接访问。
------------------------------------------------------------------------------------------
ErrorDocument 404 /error.php
RewriteEngine On
RewriteBase /
RewriteRule ^news_([0-9]+)\.html$ news.php?id=$1&page=$2
RewriteRule ^download_([0-9]+)\.html$ download.php?id=$1&page=$2
RewriteRule ^product_([0-9]+)\.html$ product.php?id=$1&page=$2
RewriteRule ^channel_([0-9]+)\.html$ index.php?id=$1
RewriteRule ^photo_([0-9]+)\.html$ photo.php?id=$1&page=$2
RewriteRule ^supply_([0-9]+)\.html$ supply.php?id=$1&page=$2
RewriteRule ^company_([0-9]+)\.html$ company.php?id=$1&page=$2
RewriteRule ^board_([0-9]+)\.html$ board.php?classid=$1&page=$2
RewriteRule ^thread_([0-9]+)_([0-9]+)\.html$ thread.php?classid=$1&id=$2
RewriteRule ^category_([a-z]+)_([0-9]+)_([0-9]+)\.html$ $1.php?classid=$2&pagestart=$3
--------------------------------------------------------------------------------------------
新增加的模块请按照上面的规则进行修改
然后保存为文件 .htaccess 。将 .htaccess 文件上传到网站根目录下
进入SiteEngine 后台 系统设置,根据需要开启静态页面功能(伪静态)
===============================================
+ 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)中加入如下代码
此时请务必注意,如果网站使用通过虚拟主机来定义
请务必加到虚拟主机配置,即 <VirtualHost> 中去,如果加在虚拟主机配置外部将可能无法使用
改好后然后将 Apache 重启。
注意:
以下规则,仅适用于程序可以通过独立域名或者二级域名直接访问。
-----------------------------------------------------------------------
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^/news_([0-9]+)\.html$ news.php?id=$1&page=$2
RewriteRule ^/download_([0-9]+)\.html$ download.php?id=$1&page=$2
RewriteRule ^/product_([0-9]+)\.html$ product.php?id=$1&page=$2
RewriteRule ^/channel_([0-9]+)\.html$ index.php?id=$1
RewriteRule ^/photo_([0-9]+)\.html$ photo.php?id=$1&page=$2
RewriteRule ^/supply_([0-9]+)\.html$ supply.php?id=$1&page=$2
RewriteRule ^/company_([0-9]+)\.html$ company.php?id=$1&page=$2
RewriteRule ^/board_([0-9]+)\.html$ board.php?classid=$1&page=$2
RewriteRule ^/thread_([0-9]+)_([0-9]+)\.html$ thread.php?classid=$1&id=$2
RewriteRule ^/category_([a-z]+)_([0-9]+)_([0-9]+)\.html$ $1.php?classid=$2&pagestart=$3
</IfModule>
-----------------------------------------------------------------------
新增加的模块请按照上面的规则进行修改
如果没有安装 mod_rewrite,您可以重新编译 Apache
并在原有 configure 的内容中加入 --enable-rewrite=shared
然后再在 Apache 配置文件中加入上述代码即可。
进入SiteEngine 后台 系统设置,根据需要开启静态页面功能(伪静态)
===============================================
+ IIS服务器(Windows主机用户)
===============================================
首先,需要安装模块
安装方法是:将iisrewrite.zip中的文件解压到服务器的一个目录中。
打开IIS管理器 -> 选择网站属性 -> ISAPI筛选器 -> 在名称中输入rewrite ->
可执行文件选择刚才解压后的文件Rewrite.dll -> 点确定
-> 再点确定 -> 关闭属性对话框
再次查看网站属性 -> 到ISAPI筛选器
如果看到状态为向上的绿色箭头,就说明Rewrite模块安装成功了
然后,修改Rewrite规则
到刚才解压的目录下,找到httpd.ini文件
httpd.ini的规则,仅适用于程序可以通过独立域名或者二级域名直接访问。
一旦修改了Rewrite规则,请重启网站,使规则生效
IIS下需要加模块。可以从这里下载
http://www.helicontech.com/download/
相关文章:
http://www.chedong.com/tech/google_url.html
|
| |
|