发布:2013/5/4 16:46:16作者:管理员 来源:本站 浏览次数:2368
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}&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、规则一定要写正确,多个传值时“&”在规则中是“&”;
4、在伪静态前一定要看看空间支持哪种方式的静态,查看phpinfo();Server API是CGI/FastCGI还是Apache Handler,伪静态文件是httpd.ini/.htaccess/Web.Config。
© Copyright 2014 - 2024 柏港建站平台 ejk5.com. 渝ICP备16000791号-4