多站点iis伪静态规则配置规则

页面导航:
→ 正文内容 Nginx伪静态配置和常用Rewrite伪静态规则
Nginx伪静态配置和常用Rewrite伪静态规则集锦
伪静态是一种可以把文件后缀改成任何可能的一种方法,如果我想把php文件伪静态成html文件,这种相当简单的,下面我来介绍nginx 伪静态配置方法有需要了解的朋友可参考。
nginx里使用伪静态是直接在nginx.conf 中写规则的,并不需要像apache要开启写模块(mod_rewrite)才能进行伪静态。
nginx只需要打开nginx.conf配置文件,在server里面写需要的规则即可。
代码如下:server { listen&&&&&& 80; server_name& bbs.jb51. index index.html index.htm index. root& /home/www/
error_page& 404&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& /404.&&&&&& #配置404错误页面 location ~ .*.(php|php5)?$ { #fastcgi_pass& unix:/tmp/php-cgi. fastcgi_pass& 127.0.0.1:9000; fastcgi_index index. include fcgi. }
#下面就是伪静态了
location /{ rewrite ^(.*)/equip(d+).html$ $1/index.php?m=content&c=index&a=lists&catid=$2 } access_log& access_log&& }
然后重启nginx服务器伪静态就生效了,这种维护起来很是不方便我们可以把它写在外部文件如bbs_nginx.conf中
在/home/www/bbs目录下创建bbs_nginx.conf文件并写入以下代码:
代码如下:ocation /{ rewrite ^(.*)/equip(d+).html$ $1/index.php?m=content&c=index&a=lists&catid=$2 }
然后在上面的代码后面加上如下代码:
代码如下:include /home/www/bbs/bbs_nginx.
这样网站根目录中的bbs_nginx.conf伪静态规则,即可实现单独管理。
下面是一个实例:
1. 在使用.htaccess文件的目录下新建一个.htaccess文件,如下面一个Discuz论坛目录:
代码如下:vim /var/www/html/jb51/bbs/.htaccess
2. 在里面输入规则,我这里输入Discuz的伪静态规则(这里仅增加Discuz的伪静态规则):
代码如下:# nginx rewrite& rule rewrite ^(.*)/archiver/((fid|tid)-[w-]+.html)$ $1/archiver/index.php?$2 rewrite ^(.*)/forum-([0-9]+)-([0-9]+).html$ $1/forumdisplay.php?fid=$2&page=$3 rewrite ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+).html$ $1/viewthread.php?tid=$2&extra=page%3D$4&page=$3 rewrite ^(.*)/profile-(username|uid)-(.+).html$ $1/viewpro.php?$2=$3 rewrite ^(.*)/space-(username|uid)-(.+).html$ $1/space.php?$2=$3 rewrite ^(.*)/tag-(.+).html$ $1/tag.php?name=$2 # end nginx rewrite rule
wq保存退出。
3. 修改nginx配置文件:
代码如下:vim& /etc/nginx/nginx.conf
4. 在需要添加伪静态的虚拟主机的server{}中引入.htaccess文件:
代码如下:include /var/www/html/jb51/bbs/. (备注:把路径改成你.htaccess文件的具体位置)
wq保存退出。
5. 重新加载nginx配置文件:
代码如下:/etc/init.d/nginx reload
Nginx常用Rewrite伪静态规则:
伪静态规则是我们做伪静态的一个非常重的参数了,如果我们能理解得越多就可以快速的写出最优的伪静态代码了,下面给大家整理了一些例子,希望能给你有帮助。
本日志内容来自互联网和平日使用经验,整理一下方便日后参考。正则表达式匹配,其中:
代码如下:* ~ 为区分大小写匹配* ~* 为不区分大小写匹配* !~和!~*分别为区分大小写不匹配及不区分大小写不匹配文件及目录匹配,其中:* -f和!-f用来判断是否存在文件* -d和!-d用来判断是否存在目录* -e和!-e用来判断是否存在文件或目录* -x和!-x用来判断文件是否可执行flag标记有:* last 相当于Apache里的[L]标记,表示完成rewrite* break 终止匹配, 不再匹配后面的规则* redirect 返回302临时重定向 地址栏会显示跳转后的地址* permanent 返回301永久重定向 地址栏会显示跳转后的地址
一些可用的全局变量有,可以用做条件判断(待补全)
代码如下:$args$content_length$content_type$document_root$document_uri$host$http_user_agent$http_cookie$limit_rate$request_body_file$request_method$remote_addr$remote_port$remote_user$request_filename$request_uri$query_string$scheme$server_protocol$server_addr$server_name$server_port$uri
结合QeePHP的例子
代码如下:if (!-d $request_filename) {rewrite ^/([a-z-A-Z]+)/([a-z-A-Z]+)/?(.*)$ /index.php?namespace=user&controller=$1&action=$2&$3rewrite ^/([a-z-A-Z]+)/?$ /index.php?namespace=user&controller=$1
多目录转成参数
代码如下:/sort/2 =& /index.php?act=sort&name=abc&id=2if ($host ~* (.*)/.domain/.com) {set $sub_name $1;rewrite ^/sort//(/d+)//?$ /index.php?act=sort&cid=$sub_name&id=$1}
代码如下:/123456/xxxx -& /xxxx?id=123456rewrite ^/(/d+)/(.+)/ /$2?id=$1例如下面设定nginx在用户使用ie的使用重定向到/nginx-ie目录下:if ($http_user_agent ~ MSIE) {rewrite ^(.*)$ /nginx-ie/$1}
目录自动加“/”
代码如下:if (-d $request_filename){rewrite ^/(.*)([^/])$ http://$host/$1$2/}
禁止htaccess
代码如下:location ~//.ht {}
禁止多个目录
代码如下:location ~ ^/(cron|templates)/ {}
禁止以/data开头的文件可以禁止/data/下多级目录下.log.txt等请求;
代码如下:location ~ ^/data {}
禁止单个目录不能禁止.log.txt能请求
代码如下:location /searchword/cron/ {}
禁止单个文件
代码如下:location ~ /data/sql/data.sql {}
给favicon.ico和robots.txt设置过期时间;这里为favicon.ico为99天,robots.txt为7天并不记录404错误日志
代码如下:location ~(favicon.ico) {log_not_expires 99d;}location ~(robots.txt) {log_not_expires 7d;}
设定某个文件的过期时间;这里为600秒,并不记录访问日志
代码如下:location ^~ /html/scripts/loadhead_1.js {access_root /opt/lampp/htdocs/expires 600;}
文件反盗链并设置过期时间这里的return 412 为自定义的http状态码,默认为403,方便找出正确的盗链的请求
代码如下:“rewrite ^/ http://www.jb51.net/jb51.”显示一张防盗链图片“access_”不记录访问日志,减轻压力“expires 3d”所有文件3天的浏览器缓存location ~* ^.+/.(jpg|jpeg|gif|png|swf|rar|zip|css|js)$ {valid_referers none blocked *.jb51.net *.jbzj.net localhost 1.1.1.1;if ($invalid_referer) {rewrite ^/ http://www.jb51.net/jb51.return 412;}access_root /opt/lampp/htdocs/expires 3d;}
只允许固定ip访问网站,并加上密码
代码如下:root /opt/htdocs/allow 208.97.167.194;allow 222.33.1.2;allow 231.152.49.4;auth_basic “C1G_ADMIN”;auth_basic_user_
将多级目录下的文件转成一个文件,增强seo效果
代码如下:/job-123-456-789.html 指向/job/123/456/789.htmlrewrite ^/job-([0-9]+)-([0-9]+)-([0-9]+)/.html$ /job/$1/$2/jobshow_$3.
将根目录下某个文件夹指向2级目录
如/shanghaijob/ 指向 /area/shanghai/如果你将last改成permanent,那么浏览器地址栏显是/location/shanghai/
代码如下:rewrite ^/([0-9a-z]+)job/(.*)$ /area/$1/$2
上面例子有个问题是访问/shanghai 时将不会匹配
代码如下:rewrite ^/([0-9a-z]+)job$ /area/$1/rewrite ^/([0-9a-z]+)job/(.*)$ /area/$1/$2
这样/shanghai 也可以访问了,但页面中的相对链接无法使用,如./list_1.html真实地址是/area/shanghia/list_1.html会变成/list_1.html,导至无法访问。那我加上自动跳转也是不行咯
代码如下:(-d $request_filename)它有个条件是必需为真实目录,而我的rewrite不是的,所以没有效果if (-d $request_filename){rewrite ^/(.*)([^/])$ http://$host/$1$2/}
知道原因后就好办了,让我手动跳转吧
代码如下:rewrite ^/([0-9a-z]+)job$ /$1job/rewrite ^/([0-9a-z]+)job/(.*)$ /area/$1/$2
文件和目录不存在的时候重定向:
代码如下:if (!-e $request_filename) {proxy_pass http://127.0.0.1;}
代码如下:server{listen 80;server_index index.html index.htm index.root /opt/lampp/htdocs/rewrite ^/ http://www.jb51.net/;access_}
多域名转向
代码如下:server_name
www.c1gstudio.index index.html index.htm index.root /opt/lampp/if ($host ~ “c1gstudio/.net”) {rewrite ^(.*) http://www.jb51.net$1}
三级域名跳转
代码如下:if ($http_host ~* “^(.*)/.i/.c1gstudio/.com$”) {rewrite ^(.*) http://www.jb51.net$1;}
代码如下:server{listen 80;server_index index.html index.htm index.root /opt/lampp/htdocs/rewrite ^/(.*) http://www.jb51.net/$1access_}
某个子目录作镜像
代码如下:location ^~ /php {rewrite ^.+ http://www.jb51.net/}
discuz ucenter home (uchome) rewrite
代码如下:rewrite ^/(space|network)-(.+)/.html$ /$1.php?rewrite=$2rewrite ^/(space|network)/.html$ /$1.rewrite ^/([0-9]+)$ /space.php?uid=$1discuz 7 rewriterewrite ^(.*)/archiver/((fid|tid)-[/w/-]+/.html)$ $1/archiver/index.php?$2rewrite ^(.*)/forum-([0-9]+)-([0-9]+)/.html$ $1/forumdisplay.php?fid=$2&page=$3rewrite ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)/.html$ $1/viewthread.php?tid=$2&extra=page/%3D$4&page=$3rewrite ^(.*)/profile-(username|uid)-(.+)/.html$ $1/viewpro.php?$2=$3rewrite ^(.*)/space-(username|uid)-(.+)/.html$ $1/space.php?$2=$3rewrite ^(.*)/tag-(.+)/.html$ $1/tag.php?name=$2给discuz某版块单独配置域名server_name bbs.jb51.net news.jb51.location = / {if ($http_host ~ news/.jb51.net$) {rewrite ^.+ http://news.jb51.net/forum-831-1.}}discuz ucenter 头像 rewrite 优化location ^~ /ucenter {location ~ .*/.php?${#fastcgi_pass unix:/tmp/php-cgi.fastcgi_pass 127.0.0.1:9000;fastcgi_index index.include fcgi.}location /ucenter/data/avatar {log_not_access_location ~ /(.*)_big/.jpg$ {error_page 404 /ucenter/images/noavatar_big.}location ~ /(.*)_middle/.jpg$ {error_page 404 /ucenter/images/noavatar_middle.}location ~ /(.*)_small/.jpg$ {error_page 404 /ucenter/images/noavatar_small.}expires 300;}}jspace rewritelocation ~ .*/.php?${#fastcgi_pass unix:/tmp/php-cgi.fastcgi_pass 127.0.0.1:9000;fastcgi_index index.include fcgi.}location ~* ^/index.php/{rewrite ^/index.php/(.*) /index.php?$1fastcgi_pass 127.0.0.1:9000;fastcgi_index index.include fcgi.}
附现在常用cms替换
WordPress伪静态规则:
代码如下:location / { index index.html index. if (-f $request_filename/index.html){ rewrite (.*) $1/index. } if (-f $request_filename/index.php){ rewrite (.*) $1/index. } if (!-f $request_filename){ rewrite (.*) /index. } }
PHPCMS伪静态规则:
代码如下:location / { ###以下为PHPCMS 伪静态化rewrite法则 rewrite ^(.*)show-([0-9]+)-([0-9]+)\.html$ $1/show.php?itemid=$2&page=$3; rewrite ^(.*)list-([0-9]+)-([0-9]+)\.html$ $1/list.php?catid=$2&page=$3; rewrite ^(.*)show-([0-9]+)\.html$ $1/show.php?specialid=$2;
####以下为PHPWind 伪静态化rewrite法则 rewrite ^(.*)-htm-(.*)$ $1.php?$2 rewrite ^(.*)/simple/([a-z0-9\_]+\.html)$ $1/simple/index.php?$2 }
ECSHOP伪静态规则:
代码如下:if (!-e $request_filename) { rewrite "^/index\.html" /index. rewrite "^/category$" /index. rewrite "^/feed-c([0-9]+)\.xml$” /feed.php?cat=$1 rewrite “^/feed-b([0-9]+)\.xml$” /feed.php?brand=$1 rewrite “^/feed\.xml$” /feed. rewrite “^/category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$” /category.php?id=$1&brand=$2&price_min=$3&price_max=$4&filter_attr=$5&page=$6&sort=$7&order=$8 rewrite “^/category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)(.*)\.html$” /category.php?id=$1&brand=$2&price_min=$3&price_max=$4&filter_attr=$5 rewrite “^/category-([0-9]+)-b([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$” /category.php?id=$1&brand=$2&page=$3&sort=$4&order=$5 rewrite “^/category-([0-9]+)-b([0-9]+)-([0-9]+)(.*)\.html$” /category.php?id=$1&brand=$2&page=$3 rewrite “^/category-([0-9]+)-b([0-9]+)(.*)\.html$” /category.php?id=$1&brand=$2 rewrite “^/category-([0-9]+)(.*)\.html$” /category.php?id=$1 rewrite “^/goods-([0-9]+)(.*)\.html” /goods.php?id=$1 rewrite “^/article_cat-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$” /article_cat.php?id=$1&page=$2&sort=$3&order=$4 rewrite “^/article_cat-([0-9]+)-([0-9]+)(.*)\.html$” /article_cat.php?id=$1&page=$2 rewrite “^/article_cat-([0-9]+)(.*)\.html$” /article_cat.php?id=$1 rewrite “^/article-([0-9]+)(.*)\.html$” /article.php?id=$1 rewrite “^/brand-([0-9]+)-c([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)\.html” /brand.php?id=$1&cat=$2&page=$3&sort=$4&order=$5 rewrite “^/brand-([0-9]+)-c([0-9]+)-([0-9]+)(.*)\.html” /brand.php?id=$1&cat=$2&page=$3 rewrite “^/brand-([0-9]+)-c([0-9]+)(.*)\.html” /brand.php?id=$1&cat=$2 rewrite “^/brand-([0-9]+)(.*)\.html” /brand.php?id=$1 rewrite “^/tag-(.*)\.html” /search.php?keywords=$1 rewrite “^/snatch-([0-9]+)\.html$” /snatch.php?id=$1 rewrite “^/group_buy-([0-9]+)\.html$” /group_buy.php?act=view&id=$1 rewrite “^/auction-([0-9]+)\.html$” /auction.php?act=view&id=$1 rewrite “^/exchange-id([0-9]+)(.*)\.html$” /exchange.php?id=$1&act= rewrite “^/exchange-([0-9]+)-min([0-9]+)-max([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$” /exchange.php?cat_id=$1&integral_min=$2&integral_max=$3&page=$4&sort=$5&order=$6 rewrite ^/exchange-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$” /exchange.php?cat_id=$1&page=$2&sort=$3&order=$4 rewrite “^/exchange-([0-9]+)-([0-9]+)(.*)\.html$” /exchange.php?cat_id=$1&page=$2 rewrite “^/exchange-([0-9]+)(.*)\.html$” /exchange.php?cat_id=$1 }
SHOPEX伪静态规则 :
代码如下:location / { if (!-e $request_filename) { rewrite ^/(.+\.(html|xml|json|htm|php|jsp|asp|shtml))$ /index.php?$1 } }
SaBlog 2.0:
代码如下:# 只带月份的归档 rewrite "^/date/([0-9]{6})/?([0-9]+)?/?$" /index.php?action=article&setdate=$1&page=$2 # 无分类翻页 rewrite ^/page/([0-9]+)?/?$ /index.php?action=article&page=$1 # 分类 rewrite ^/category/([0-9]+)/?([0-9]+)?/?$ /index.php?action=article&cid=$1&page=$2 rewrite ^/category/([^/]+)/?([0-9]+)?/?$ /index.php?action=article&curl=$1&page=$2 # 归档、高级搜刮 rewrite ^/(archives|search|article|links)/?$ /index.php?action=$1 # 全数批评、标签列表、引用列表 带分页 rewrite ^/(comments|tagslist|trackbacks|article)/?([0-9]+)?/?$ /index.php?action=$1&page=$2 # tags rewrite ^/tag/([^/]+)/?([0-9]+)?/?$ /index.php?action=article&item=$1&page=$2 # 文章 rewrite ^/archives/([0-9]+)/?([0-9]+)?/?$ /index.php?action=show&id=$1&page=$2 # RSS rewrite ^/rss/([0-9]+)?/?$ /rss.php?cid=$1 rewrite ^/rss/([^/]+)/?$ /rss.php?url=$1 # 用户 rewrite ^/uid/([0-9]+)/?([0-9]+)?/?$ /index.php?action=article&uid=$1&page=$2 rewrite ^/user/([^/]+)/?([0-9]+)?/?$ /index.php?action=article&user=$1&page=$2 # 舆图文件 rewrite sitemap.xml sitemap. # 自界说链接 rewrite ^(.*)/([0-9a-zA-Z\-\_]+)/?([0-9]+)?/?$ $1/index.php?action=show&alias=$2&page=$3
Discuz 7伪静态规则 :
代码如下:rewrite ^/archiver/((fid|tid)-[\w\-]+\.html)$ /archiver/index.php?$1 rewrite ^/forum-([0-9]+)-([0-9]+)\.html$ /forumdisplay.php?fid=$1&page=$2 rewrite ^/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ /viewthread.php?tid=$1&extra=page\%3D$3&page=$2 rewrite ^/space-(username|uid)-(.+)\.html$ /space.php?$1=$2 rewrite ^/tag-(.+)\.html$ /tag.php?name=$1
代码如下:location / { index index.html index. if (-f $request_filename/index.html){ rewrite (.*) $1/index. } if (-f $request_filename/index.php){ rewrite (.*) $1/index. } if (!-f $request_filename){ rewrite (.*) /index. } }
实例:shopex启用伪静态
代码如下:……
&&& location /
&&&&&&&&&&&& if (!-e $request_filename) {
&&&&&&&&&&&& rewrite ^/(.*)$ /index.php?$1
您可能感兴趣的文章:
上一篇:下一篇:
最 近 更 新
热 点 排 行
12345678910phpwind9.0伪静态规则配置|phpwind教程 - phpwind模板网 - Powered by phpwind
查看完整版本: [--
phpwind9.0伪静态规则配置
目前,phpwind9.0中的伪静态机制可实现站长自由调整每个页面的静态格式,而且修改静态格式后不需要变动修改服务器的 Rewrite 规则设置,你只要提供一条简单的规则把所有请求转到index.php即可。 当然,首先你需要开启服务器的rewrite模块。 &&下面附上apache和nginx下的伪静态规则,iis用户可参照apache下的规则。 apache下(独立主机): RewriteEngine On RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [NC,L] RewriteRule !.(js|ico|gif|jpe?g|bmp|png|css)$ /index.php [NC,L] apache的虚拟主机用户: RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [NC,L] RewriteRule !.(js|ico|gif|jpe?g|bmp|png|css)$ /index.php [NC,L] &&nginx下: if (-f $request_filename) { &&&&&&&& } if ($request_filename ~* &\.(js|ico|gif|jpe?g|bmp|png|css)$&) { &&&& } if (!-e $request_filename) { &&&&rewrite . /index. } && 附:apache下的.htaccess文件(放到phpwind9中/www目录下)即可。
至此,rewrite配置已经结束,到站点后台全局-URL伪静态中开启你所需页面的伪静态。
phpwind9.0 老版本组件(rewrite3以下)伪静态规则出炉啦
=700) window.open('http://www.phpwind.net/res/images/emotion/ymt/19.gif');" style="max-width:700max-height:700" onload="if(is_ie6&&this.offsetWidth>700)this.width=700;" >=700) window.open('http://www.phpwind.net/res/images/emotion/ymt/19.gif');" style="max-width:700max-height:700" onload="if(is_ie6&&this.offsetWidth>700)this.width=700;" >=700) window.open('http://www.phpwind.net/res/images/emotion/ymt/19.gif');" style="max-width:700max-height:700" onload="if(is_ie6&&this.offsetWidth>700)this.width=700;" >=700) window.open('http://www.phpwind.net/res/images/emotion/ymt/19.gif');" style="max-width:700max-height:700" onload="if(is_ie6&&this.offsetWidth>700)this.width=700;" >=700) window.open('http://www.phpwind.net/res/images/emotion/ymt/19.gif');" style="max-width:700max-height:700" onload="if(is_ie6&&this.offsetWidth>700)this.width=700;" >=700) window.open('http://www.phpwind.net/res/images/emotion/ymt/19.gif');" style="max-width:700max-height:700" onload="if(is_ie6&&this.offsetWidth>700)this.width=700;" >=700) window.open('http://www.phpwind.net/res/images/emotion/ymt/19.gif');" style="max-width:700max-height:700" onload="if(is_ie6&&this.offsetWidth>700)this.width=700;" >=700) window.open('http://www.phpwind.net/res/images/emotion/ymt/19.gif');" style="max-width:700max-height:700" onload="if(is_ie6&&this.offsetWidth>700)this.width=700;" > 由于PW9.0,IIS下的伪静态规则采用了 RewriteCond语法,老版本的rewrite不支持。 假如,你是: 1、虚拟主机的用户有木有,不支持.htaccess 。 2、不能安装isapi_rewrite 第三版,老版本的rewrite不支持RewriteCond语法。 经过多次测试终于在老版本rewrite下把部分伪静态规则测试成功啦。现在分享给大家!! &&&& =700) window.open('http://www.phpwind.net/res/images/emotion/ymt/36.gif');" style="max-width:700max-height:700" onload="if(is_ie6&&this.offsetWidth>700)this.width=700;" >=700) window.open('http://www.phpwind.net/res/images/emotion/ymt/36.gif');" style="max-width:700max-height:700" onload="if(is_ie6&&this.offsetWidth>700)this.width=700;" >=700) window.open('http://www.phpwind.net/res/images/emotion/ymt/36.gif');" style="max-width:700max-height:700" onload="if(is_ie6&&this.offsetWidth>700)this.width=700;" >=700) window.open('http://www.phpwind.net/res/images/emotion/ymt/36.gif');" style="max-width:700max-height:700" onload="if(is_ie6&&this.offsetWidth>700)this.width=700;" >=700) window.open('http://www.phpwind.net/res/images/emotion/ymt/36.gif');" style="max-width:700max-height:700" onload="if(is_ie6&&this.offsetWidth>700)this.width=700;" >=700) window.open('http://www.phpwind.net/res/images/emotion/ymt/36.gif');" style="max-width:700max-height:700" onload="if(is_ie6&&this.offsetWidth>700)this.width=700;" >=700) window.open('http://www.phpwind.net/res/images/emotion/ymt/36.gif');" style="max-width:700max-height:700" onload="if(is_ie6&&this.offsetWidth>700)this.width=700;" >=700) window.open('http://www.phpwind.net/res/images/emotion/ymt/36.gif');" style="max-width:700max-height:700" onload="if(is_ie6&&this.offsetWidth>700)this.width=700;" > 进入正题!!1 进入后台:全局→url伪静态 此次只伪静态了以下几项,其他的大家一起探讨!!
论坛帖子列表页:thread/{fid}/{page} 论坛帖子阅读页:read/{tid}/{page} 个人空间:u/{uid} 话题浏览页:tag/{name} 设置这四项同时勾选后面勾勾(如下图) =700) window.open('http://img1.phpwind.net/attachout/thumb/1301/thread/2_a7be04d4d58d0.jpg');" style="max-width:700max-height:700" onload="if(is_ie6&&this.offsetWidth>700)this.width=700;" >
重点的伪静态规则,请复制粘贴到规则目录下的httpd.ini 中 (解决帖子列表中查看 最新发帖 问题) 复制代码12345678910# thread/{fid}/{page}&&RewriteRule ^(.*)/thread/([0-9]+)/([0-9]+)(\?(.*))*$ $1/index\.php\?m=bbs&c=thread&fid=$2 RewriteRule ^(.*)/thread/([0-9]+)\?*(.*)$ $1/index\.php\?m=bbs&c=thread&fid=$2$3 # read/{tid}/{page}&&RewriteRule ^(.*)/read/([0-9]+)/([0-9]+)(\?(.*))*$ $1/read\.php\?tid=$2&fid=$3&page=$4 RewriteRule ^(.*)/read/([0-9]+)(\?(.*))*$ $1/read\.php\?tid=$2&fid=$3&page=$4 # u/{uid}&&RewriteRule ^(.*)/u/([0-9]+)(\?(.*))*$ $1/index\.php\?m=space&uid=$2 # tag/{name}&&RewriteRule ^(.*)/tag/([A-Z0-9%]+)(\?(.*))*$ $1/index\.php\?m=tag&a=view&name=$2
提醒使用IIS为WEB服务器的站长,假如你服务器 w3wp.exe的cpu使用率过高,很大的原因是你安装了isapi_rewrite第三版(而且此版本还要收费)的原因,你卸载掉这个使用老版的 rewrite 加以上规则试试,也许就解决了你的问题哟!要是觉得还行就使命顶吧!!
升级phpwind9.0后,url伪静态兼容8.7的方案
本主题是适用有独立主机权限,或者支持.htaccess的站长。 升级前pw8.7的地址是这样的 目录: 1楼是iis,apache,nginx常见方法 2楼是常见问题解答 首先需要确定服务器支持rewrite模块并开启了 IIS配置
IIS配置 [ISAPI_Rewrite]# Defend your computer from some worm attacksRewriteRule .*(?:global.asa|default\.ida|root\.exe|\.\.).* . [F,I,O]&&&&&&&&&&&&&& RewriteRule ^(.*)-htm-(.*)$ $1.php?$2 [R=301,L]&&&&&&&&&&&&&&RewriteBase /RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule !\.(js|ico|gif|jpe?g|bmp|png|css)$ index.php [L]Nginx配置
Nginx配置 #rewrite ^(.*)-htm-(.*)$ $1.php?$2这条规则未必能用所以注释掉rewrite ^(.*)/read-htm-tid-(\d+).html$ $1/read.php?tid=$2location / {&&&&if (-f $request_filename) {&&&&&&&&&&&&&&}&&&&if ($request_filename ~* &\.(js|ico|gif|jpe?g|bmp|png|css)$&) {&&&&&&&&&&&&}&&&&if (!-e $request_filename) {&&&&&&&&rewrite . /index.&&&&}}
apache配置 复制代码RewriteEngine OnRewriteRule ^(.*)-htm-(.*)$ $1.php?$2如果pw论坛装在子目录,最后一条规则要改成(apache和nginx应该也要同理) 复制代码RewriteRule&&!\.(js|ico|gif|jpe?g|bmp|png|css)$ /pw9_yingyong/index.php [L]
问题1:如果发现iis下,程序提供的伪静态规则无效的话,可以用rewrite来临时解决下 RewriteRule ^(.*)/forum-(\d+)(-(\d+))*$&&$1/index.php\?m=bbs&c=thread&fid=$2&page=$4RewriteRule ^(.*)/read-(\d+)(-(\d+))*$&&$1/read.php\?tid=$2&page=$4程序里面的路由配置,有些问题,后续找下相关的开发人员来解决。 iis装rewrite3.0无效,可以装2.0试试,具体参考
问题2:某些nginx服务器使用上述规则无效,可以使用这个 nginx兼容之前版本的链接地址 附录: 伪静态有关的wiki
dz等其他程序转换至PW后如何使用伪静态保持流量 for pw9.0
非常强大的教程,感谢楼主 的分享,学习了。
谢谢分享 。 。
&&谢谢楼主的分享!!
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& &&&&分享!
正需要此内容,谢谢楼主分享! &&&&
iis下可不可以的啊?
伪静态规则出炉啦
用户被禁言,该主题自动屏蔽!
用户被禁言,该主题自动屏蔽!
为了金币。。。
rbtylimeb翰阅坊执着于高质量的服务,为众多莘莘学子争取更多高端的海外学习机会,务求让我国学子能步上成功的阶梯,创造一个不平凡的人生;翰阅坊一直致力直接挑选高质的合作伙伴,2013年9月翰阅坊香港总公司取得到米其林级别的 “法国歌斯厨艺学院”在中国大陆及香港区域的总代理权。在全世界范围内,拿到 “法国厨艺学院总代理权”的国家仅仅有有美国,中国,中国香港,巴西,马来西亚,澳洲,日本,菲律宾等等10多个国家。=700) window.open('/article/uploadfiles/8.jpg');" style="max-width:700max-height:700" onload="if(is_ie6&&this.offsetWidth>700)this.width=700;" >法国厨艺教育,是首个中法联合教育项目,该项目进入中国这片热土,不仅仅是对中国的一大肯定,更加促中国与国际接轨。米其林以其在全世界昭著的影响力和号召力选择了“翰阅坊”为合作伙伴,让“翰阅坊”成为他们在中国和中国香港的总代理,并肩合作发展成为国际性的指标,让中国的美食在保留自己的原味上的基础上更加的国际化,与国际市场同步甚至领先,进而成为世界餐饮文化的典范。 更多米其林级别法国歌斯厨艺学院课程资讯动态关注 翰阅坊官方平台免费热线:400-614-4448公司电话:7官方网站:官方微信:cardinalhk(翰阅坊)官方微博:
我的始终设置不成功。
查看完整版本: [--
Powered by
Time 0.241034 second(s),query:6 Gzip enabled}

我要回帖

更多关于 iis伪静态规则 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信