找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 1105|回复: 0
打印 上一主题 下一主题

php 伪静态之IIS篇

[复制链接]

2487

主题

2487

帖子

7391

积分

论坛元老

Rank: 8Rank: 8

积分
7391
跳转到指定楼层
楼主
发表于 2018-2-14 05:58:03 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

            有的win主机IIS不支持 .htaccess 文件, 我在这里指的不是本地 在本地的话用apmserv服务器可以用.htaccess 文件,用apmserv服务器环境配置伪静态可以看 php 伪静态 (url rewrite mod_rewrite 重写) 这篇文章,讲的很详细.
这里我们主要讲解httpd.ini 废话不说直接看效果~
例: www.jb51.net/index.php
我们想让他用 www.jb51.net/index.html 来直接访问
www.jb51.net/newxx.php?=10 [newxx.php 是新闻的详细页面]
我们把他伪静态成为 www.jb51.net/new-10.html
实现过程如下:httpd.ini 的源文件
[ISAPI_Rewrite]
# 3600 = 1 hour
# CacheClockRate 3600
RepeatLimit 32
# Protect httpd.ini and httpd.parse.errors files
# from accessing through HTTP
RewriteRule ^/httpd(?:\.ini|\.parse\.errors).* [F,I,O]
RewriteRule /index.html /index.php
RewriteRule /new-([0-9]+).html$ /newxx\.php\?uid=$1上面的例子可以看出 RewriteRule /index.html /index.php 是把index.php 转换为 index.html
RewriteRule /new-([0-9]+).html$ /newxx\.php\?uid=$1 转换为 new-10{这个10为id=几的值}.html
很简单吧。 这种伪静态一般 win主机的空间商基本都支持的!
            
            
您可能感兴趣的文章:
  • PHP伪静态写法附代码
  • PHP伪静态页面函数附使用方法
  • 不用mod_rewrite直接用php实现伪静态化页面代码
  • PHP 伪静态隐藏传递参数名的四种方法
  • 基于php伪静态的实现详细介绍
  • PHP 伪静态技术原理以及突破原理实现介绍
  • thinkphp路由规则使用示例详解和伪静态功能实现(apache重写)
  • php伪静态之APACHE篇
  • PHP伪静态Rewrite设置之APACHE篇
  • Linux中为php配置伪静态
  • PHP实现伪静态方法汇总
            
  • 分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
    收藏收藏
    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    用户反馈
    客户端