读书人

joomla在IIS7中的伪静态设置异常

发布时间: 2012-06-29 15:48:47 作者: rapoo

joomla在IIS7中的伪静态设置错误
今天早晨做joomla的伪静态设置,一直出现404错误,后来经过多方查找,发现错误的根源在于空间商的系统是WIN的系统,而自己一直用的是更改.access文件的做法,自然解决不了问题。现将解决过程分享如下:
首先,确保空间商的II7有rewriteing的支持;
其次新建一个web.config文件,将以下代码拷贝到web.config中,并将其拷贝到joomla网站目录下;

<?xml version="1.0" encoding="UTF-8"?><configuration>  <system.webServer>    <rewrite>      <rules>        <rule name="Security Rule" stopProcessing="true">          <match url="^(.*)$" ignoreCase="false" />          <conditions logicalGrouping="MatchAny">            <add input="{QUERY_STRING}" pattern="mosConfig_[a-zA-Z_]{1,21}(=|\%3D)" ignoreCase="false" />            <add input="{QUERY_STRING}" pattern="base64_encode.*\(.*\)" ignoreCase="false" />            <add input="{QUERY_STRING}" pattern="(\<|%3C).*script.*(\>|%3E)" />            <add input="{QUERY_STRING}" pattern="GLOBALS(=|\[|\%[0-9A-Z]{0,2})" ignoreCase="false" />            <add input="{QUERY_STRING}" pattern="_REQUEST(=|\[|\%[0-9A-Z]{0,2})" ignoreCase="false" />          </conditions>          <action type="CustomResponse" url="index.php" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" />        </rule>        <rule name="SEO Rule">          <match url="(.*)" ignoreCase="false" />          <conditions logicalGrouping="MatchAll">            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" pattern="" ignoreCase="false" />            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" pattern="" ignoreCase="false" />            <add input="{URL}" negate="true" pattern="^/index.php" ignoreCase="false" />            <add input="{URL}" pattern="(/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$" />          </conditions>          <action type="Rewrite" url="index.php" />        </rule>      </rules>    </rewrite> </system.webServer></configuration>

最后,开启joomla的seo,如下图所示:


读书人网 >IIS

热点推荐