分享下IIS下php伪静态的实现过程。
php
有的win主机IIS不支持 .htaccess 文件, 在这里指的不是本地 在本地的话用apmserv服务器能够用.htaccess 文件,用apmserv服务器环境配置伪静态能够看 php 伪静态 (url rewrite mod_rewrite 重写) 这篇文章,讲的很详细.
这里咱们主要讲解httpd.ini 废话不说直接看效果~
例: www.jbxue.com/index.php
咱们想让他用 www.jbxue.com/index.html 来直接访问
www.jbxue.com/newxx.php?=10 [newxx.php 是新闻的详细页面]
咱们把他伪静态成为 www.jbxue.com/new-10.html
实现过程以下:httpd.ini 的源文件
html
[ISAPI_Rewrite]
服务器
# 3600 = 1 hour
ui
# CacheClockRate 3600
url
RepeatLimit 32
spa
# Protect httpd.ini and httpd.parse.errors files
htm
# from accessing through HTTP
get
RewriteRule ^/httpd(?:\.ini|\.parse\.errors).* [F,I,O]
it
RewriteRule /index.html /index.php
配置
RewriteRule /new-([0-9]+).html$ /newxx\.php\?uid=$1
上面的例子能够看出 RewriteRule /index.html /index.php 是把index.php 转换为 index.htmlRewriteRule /new-([0-9]+).html$ /newxx\.php\?uid=$1 转换为 new-10{这个10为id=几的值}.html很简单吧。 这种伪静态通常 win主机的空间商基本都支持的!