Nov 28

PHPWind在虚拟主机下使用伪静态REWRITE功能说明 不指定

Posted by yufeng at 17:26 | 网络转载 | 评论(1) | 阅读(155) | 转自 本站原创 | |
首先要虚拟主机的PHPWind支持伪静态REWRITE功能,必须先支持.htaccess功能及rewrite模块
如何得知虚拟主机支持rewrite模块?
你可以在搜索引擎搜索PHP探针,把PHP探针上传到虚拟主机检查或请写一个PHPINFO.PHP的文件,内容为

<?php
phpinfo();
?>


上传到虚拟主机,查看是否有MOD_REWRITE功能

使用伪静态REWRITE功能有何好处?
伪静态REWRITE主要把论坛地址的.php改为.html,借此模仿html页,因搜索引擎收录html页比php页较好,所以使用伪静态REWRITE功能好处是大大地提高论坛被搜索引擎收录的数目

如果发现虚拟主机支持.htaccess功能及rewrite模块,又想用伪静态REWRITE功能,可以依照以下方法,按自己的需要决定:

正文:
1.只需要无图版使用REWRITE功能,你可以在建立后上传于虚拟主机的.htaccess输入以下文字:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)simple/([a-z0-9\_]+\.html)$ $1/simple/index.php?$2
</IfModule>

上传后请在/simple/index.php把无图版模式改为第3种

2.只需要论坛(不包括无图版)使用REWRITE功能,可以在建立后上传于虚拟主机的.htaccess输入以下文字:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)-htm-(.*)$ $1.php?$2
</IfModule>

上传后请在后台的静态目录部署把静态目录部署功能开启及把静态目录设置为-htm-,静态目录扩展名设置为.html

3.需要论坛及无图版使用REWRITE功能,可以在建立后上传于虚拟主机的.htaccess输入以下文字:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)-htm-(.*)$ $1.php?$2
RewriteRule ^(.*)simple/([a-z0-9\_]+\.html)$ $1/simple/index.php?$2
</IfModule>

上传后请在/simple/index.php把无图版模式改为第3种和在后台的静态目录部署把静态目录部署功能开启及把静态目录设置为-htm-,静态目录扩展名设置为.html

4.在2月27日更新前,静态目录为/htm/,又想和现在的静态目录-htm-两者可同时访问及无图版也使用REWRITE功能,可在建立然上传于虚拟主机的.htaccess输入以下文字:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)-htm-(.*)$ $1.php?$2
RewriteRule ^(.*)/htm/(.*)$ $1.php?$2
RewriteRule ^(.*)simple/([a-z0-9\_]+\.html)$ $1/simple/index.php?$2
</IfModule>


上传后请在/simple/index.php把无图版模式改为第3种和在后台的静态目录部署把静态目录部署功能开启及把静态目录设置为-htm-,静态目录扩展名设置为.html

若你需要使用伪静态功能,需要多修改一点代码才能正常运行风格切换插件,代码如下:
论坛根目录下的GLOBAL.PHP文件
找到代码
if(ereg("^http|ftp|telnet|mms|rtsp|admin.php|rss.php",$url)===false){

修改为:
if(ereg("^http|ftp|telnet|mms|rtsp|admin.php|index.php|rss.php",$url)===false){



部份资料来自: http://www.phpwind.net/read-htm-tid-164639.html

yufeng
2008/11/28 22:01
分页: 1/1 第一页 1 最后页
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   游客无需密码
网址   电邮   [注册]