WIN IIS7.0 Rewrite 伪静态设置使用说明

WIN IIS7.0 Rewrite 伪静态设置使用说明【godaddy WIN .NET/PHP空间IIS7.0伪静态设置】
网站根目录建立 Web.Config 配置文件(文件名大小写敏感!)
Web.Config 添加规则:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
	<system.webServer>
    	<rewrite>
        	<rules>
            	<rule name="Rewrite to index.php" stopProcessing="true">
                	<match url="^index.html" />
                	<action type="Rewrite" url="index.php"  />
                </rule>
                <rule name="Rewrite to article.php" stopProcessing="true">
                	<match url="^article_(\d+).html" />
                    <action type="Rewrite" url="article.php?id={R:1}" />
                </rule>
                <rule name="Rewrite to list.php" stopProcessing="true">
                	<match url="^list_(\d+)_(\d+).html" />
                    <action type="Rewrite" url="list.php?id={R:1}&amp;page={R:2}" />
                </rule>
                <rule name="Rewrite to sitemap.php" stopProcessing="true">
                	<match url="^sitemap.xml" />
                    <action type="Rewrite" url="sitemap.php"  />
                </rule>
        	</rules>
    	</rewrite>
	</system.webServer>
</configuration>
 

保存修改!


建立 index.php:
<?php
echo "Hello World!";
?>


测试:
http://网址/index.html,如网页中有Hello World!则配置成功!如需要可以配置更多的规则!
上述是针对PHP配置的规则,ASP.NET同理!

注:
1、配置文件名Web.Config大小写注意;
2、Web.Config必须放到网站根目录;
3、规则一定要写正确,多个传值时“&”在规则中是“&amp;”;
4、在伪静态前一定要看看空间支持哪种方式的静态,查看phpinfo();Server API是CGI/FastCGI还是Apache Handler,伪静态文件是httpd.ini或.htaccess或Web.Config。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值