阅读:9533回复:7

phpwind 伪静态设置

楼主#
更多 发布于:2012-01-15 11:40


什么是伪静态?




伪静态原理:动态网页通过重写URL的方法实现去掉动态网页的参数,伪静态和静态的区别


伪静态有什么用?


最主要的就是迎合搜索引擎方便搜索引擎蜘蛛(Spider)来抓取网页上的相关内容!方便用户访问网站 一个好网页如果是动态的用户在相互传播时感觉对方信任度不会高,但一看一个静态页相对用户对网页的信任度就高点而且伪静态的后缀方式基本雷同 一看就知道是伪静态还是真的静态网页!


伪静态在PHPWind的应用


如果您租用虚拟主机,请确定空间支持伪静态模式,最常用的是.htaccess 针对apache的WEB端配置。如果您用的是独立主机,那么可以在服务器上配置支持伪静态模式。先说虚拟空间默认支持.htaccess自定义伪静态(一般是linux虚拟机)
.htaccess的配置,把以下代码保存为.htaccess 传到服务器根目录即可.<IfModule mod_rewrite.c>RewriteEngine OnRewriteRule ^(.*)-htm-(.*)$ $1.php?$2RewriteRule ^(.*)simple/([t|f].+).html$ /simple/index.php?$2.html</IfModule>
独立服务器者,若是win2003+iis,那您需要安装一个组件叫:ISAPI_Rewrite,安装完后编辑httpd.ini文件,内容如下:
[ISAPI_Rewrite]# Defend your computer from some worm attacksRewriteRule .*(?:global.asa|default.ida|root.exe|..).* . [F,I,O]RewriteRule ^(.*)-htm-(.*)$ $1.php?$2RewriteRule ^(.*)/simple/([a-z0-9_]+.html)$ $1/simple/index.php?$2#Code By Josh @ PHPWind 2008-10-08 ?([a-zA-Z]+)
如果是老版本的,请把
RewriteRule ^(.*)-htm-(.*)$ $1.php?$2
这条规则改为
RewriteRule ^(.*)-htm-(.*)$ $1/.php?/$2即可,
ISAPI_Rewrite安装教程请看:PW论坛IIS下设置静态目录的教程



PHPWind伪静态应用实例

不可否认,Rewrite 受到很多站长的喜欢,也受几个大的搜索引擎所亲睐,在7版本升级之际把这个传说中的神秘方法分享给大家,先看下案例 ,如dedecms,huodao等论坛的伪静态,下面是ST的板块访问地址:http://www.stwind.org/_22 帖子访问地址:http://www.stwind.org/r5764.html (完全可以做到/5764.html,按个人喜好!)
高级应用版本请看: PW伪静态之简单而强大设置教程(美观浏览地址)修正圣诞版本
喜欢0 评分0
[url=http://www.ibdbbs.com/]炎症性肠病家园[/url]
沙发#
发布于:2012-01-16 01:19
  1. [ISAPI_Rewrite]
  2.   # RewriteEngine on  code by Jason at Hangzhou
  3.    RewriteRule ^(.*)thread-htm-tid-(\d+)-(.*).html   $1/thread.php?fid=$2
  4.    RewriteRule ^(.*)read-htm-tid-(\d+)-(.*).html   $1/read.php?tid=$2
  5.    RewriteRule ^(.*)commtopics-(\d+)-(.*)    $1/thread.php?fid=$2;page=$3
  6.    RewriteRule ^(.*)commtopics-(.*)        $1/thread.php?fid=$2;page=$3
  7.    RewriteRule ^(.*)article-(\d+)-(\d+)-(.*).html    $1/read.php?tid=$2;page=$3;fpage=$4
  8.    RewriteRule ^(.*)article-(\d+)-(.*).html        $1/read.php?tid=$2;page=$3#a
  9.    RewriteRule ^(.*)article-(.*).html              $1/read.php?tid=$2
  10.    RewriteRule ^(.*)-htm-(.*)$               $1.php?$2
  11.    RewriteRule ^(.*)/simple/([a-z0-9\_]+\.html)$ $1/simple/index.php?$2
[url=http://www.ibdbbs.com/]炎症性肠病家园[/url]
回复(0) 喜欢(0)     评分
板凳#
发布于:2012-01-16 01:30
[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
# Collected By QQ:781662377(BBS.97CK.COM)
RepeatLimit 32


RewriteRule ^(.*)-htm-m-bbs.html$ $1.php?m=bbs
RewriteRule ^(.*)-htm-m-cms.html$ $1.php?m=cms
RewriteRule ^(.*)-htm-m-o.html$ $1.php?m=o
RewriteRule ^(.*)-htm-m-area.html$ $1.php?m=area
RewriteRule ^(.*)-htm-step-finish-verify-(.*).html$ $1.php?action=register
RewriteRule ^(.*)-htm-(.*)tid-(.*)-page-(.*).html$ $1.php?tid=$3;page=$3
RewriteRule ^(.*)-htm-username-(.*).html$ $1.php?uesrname=$2
RewriteRule ^(.*)-htm-fid-(.*)-search-(.*).html$ $1.php?fid=$2;search=$3
RewriteRule ^(.*)-htm-(.*)fid-(.*)-type-(.*).html$ $1.php?$2fid=$3;type=$4
RewriteRule ^(.*)-htm-(.*)fid-(.*)$ $1.php?$2fid=$3
RewriteRule ^(.*)-htm-(.*)tid-(.*)$ $1.php?$2tid=$3
RewriteRule ^(.*)-htm-(.*)faqjob-(.*)$ $1.php?$2faqjob=$3
RewriteRule ^(.*)-htm-(.*)cateid-(.*)$ $1.php?$2cateid=$3
RewriteRule ^(.*)-htm-H_name-(.*)-action-(.*).html$ $1.php?H_name=$2;action=$3
RewriteRule ^(.*)-htm-H_name-(.*).html$ $1.php?H_name=$2
RewriteRule ^(.*)-htm-action-show-uid-(.*).html$ $1.php?action=show;uid=$2
RewriteRule ^(.*)-htm-action-show-username-(.*).html$ $1.php?action=show;username=$2
RewriteRule ^(.*)-htm-action-(.*).html$ $1.php?action=$2
RewriteRule ^(.*)-htm-action-read-mid-(.*).html$ $1.php?action=read;mid=$2
RewriteRule ^(.*)-htm-uid-(.*).html$ $1.php?uid=$2
RewriteRule ^(.*)/simple/([a-z0-9_]+.html)$ $1/simple/index.php?$2
[url=http://www.ibdbbs.com/]炎症性肠病家园[/url]
回复(0) 喜欢(0)     评分
地板#
发布于:2012-01-16 01:40
[ISAPI_Rewrite]
# 本规则支持phpwind
RewriteRule ^(.*)-htm-(.*)$ $1\.php\?$2
RewriteRule ^(.*)/simple/([a-z0-9_]+.html)$ $1/simple/index.php?$2
RewriteRule ^index\.html$ index.php
RewriteRule ^login\.html$ login.php
RewriteRule ^register\.html$ register.php
RewriteRule ^profile\.html$ profile.php
RewriteRule ^(.*?)/([0-9]+)$ $1\.php\?uid=$2
[ISAPI_Rewrite]
# Defend your computer from some worm attacks
RewriteRule .*(?:global.asa|default\.ida|root\.exe|\.\.).* . [F,I,O]

RewriteRule ^(.*)/archiver/ /simple/ [R]
RewriteRule ^(.*)/fid-(\d+)\.html /simple/index\.php\?f$2.html [R]
RewriteRule ^(.*)/fid-(\d+)-page-1.html /simple/index\.php\?f$2.html [R]
RewriteRule ^(.*)/tid-(\d+)-page-1.html /simple/index\.php\?t$2.html [R]
RewriteRule ^(.*)/tag-(.*)\.html $1/job\.php\?action=tag;tagname=$2 [R]

RewriteRule ^(.*)thread-(\d+)-(\d+)-(\d+)\.html $1/read\.php\?tid=$2
RewriteRule ^(.*)forum-(\d+)-(\d+)\.html $1/thread\.php\?fid=$2

RewriteRule ^(.*)-htm-(.*)$ $1\.php\?$2
RewriteRule ^(.*)/simple/([a-z0-9\_]+\.html)$ $1/simple/index\.php\?$2
[url=http://www.ibdbbs.com/]炎症性肠病家园[/url]
回复(0) 喜欢(0)     评分
4楼#
发布于:2012-01-16 02:09
如果是windows主机,先在PW后台开启,然后上传一个httpd.ini格式的伪静态规则到论坛根目录,就可以实现的。
规则如下:
[ISAPI_Rewrite]
# 本规则支持phpwind
RewriteRule ^(.*)-htm-(.*)$   $1\.php\?$2
RewriteRule ^(.*)/simple/([a-z0-9_]+.html)$ $1/simple/index.php?$2
RewriteRule ^index\.html$ index.php
RewriteRule ^login\.html$ login.php
RewriteRule ^register\.html$ register.php
RewriteRule ^profile\.html$ profile.php
RewriteRule ^(.*?)/([0-9]+)$ $1\.php\?uid=$2
将以上规则保存为httpd.ini格式,上传至论坛根目录即可。
详细你可以参考科网主机技术论坛,他们技术员有发帖说明的。
希望能帮到你
[url=http://www.ibdbbs.com/]炎症性肠病家园[/url]
回复(0) 喜欢(0)     评分
5楼#
发布于:2012-01-16 21:18
RewriteRule ^(.*)-htm-(.*)$ $1\.php\?$2
RewriteRule ^(.*)/u/([0-9]+)$ $1/u\.php\?uid=$2
RewriteRule ^(.*)/simple/([a-z0-9_]+.html)$ $1/simple/index.php?$2
[url=http://www.ibdbbs.com/]炎症性肠病家园[/url]
回复(0) 喜欢(0)     评分
6楼#
发布于:2012-01-18 01:02
[ISAPI_Rewrite]
   # RewriteEngine on  code by Jason at Hangzhou
    RewriteRule ^(.*)thread-htm-tid-(\d+)-(.*).html   $1/thread.php?fid=$2
    RewriteRule ^(.*)read-htm-tid-(\d+)-(.*).html   $1/read.php?tid=$2
    RewriteRule ^(.*)commtopics-(\d+)-(.*)    $1/thread.php?fid=$2;page=$3
    RewriteRule ^(.*)commtopics-(.*)        $1/thread.php?fid=$2;page=$3
    RewriteRule ^(.*)article-(\d+)-(\d+)-(.*).html    $1/read.php?tid=$2;page=$3;fpage=$4
    RewriteRule ^(.*)article-(\d+)-(.*).html        $1/read.php?tid=$2;page=$3#a
    RewriteRule ^(.*)article-(.*).html              $1/read.php?tid=$2
    RewriteRule ^(.*)-htm-(.*)$               $1.php?$2
    RewriteRule ^(.*)/simple/([a-z0-9\_]+\.html)$ $1/simple/index.php?$2
[url=http://www.ibdbbs.com/]炎症性肠病家园[/url]
回复(0) 喜欢(0)     评分
7楼#
发布于:2012-01-19 10:03
[ISAPI_Rewrite]

# 3600 = 1 hour
CacheClockRate 3600

RepeatLimit 32


RewriteRule ^(.*)-htm-(.*)$ $1\.php\?$2
RewriteRule ^(.*)/u/([0-9]+)$ $1/u\.php\?uid=$2
RewriteRule ^(.*)/simple/([a-z0-9_]+.html)$ $1/simple/index.php?$2
[url=http://www.ibdbbs.com/]炎症性肠病家园[/url]
回复(0) 喜欢(0)     评分
游客

返回顶部