如何设置IIS7将所有内容传递给Joomla?

上下文:IIS7,Win7,Joomla 1.5

有了这个URL http:// website / foo ,如果我在Joomla安装的根目录下有一个名为“foo”的子目录,IIS7会尝试在其中findindex.php,并在Joomla开始之前返回403。

有了这个URL, http:// website / bar ,如果我没有名为“bar”的子目录,IIS7将URL传递给Joomla,并让它处理页面是否存在。

在http:// website / foo的情况下 ,我该如何设置IIS7,以便忽略“foo”子目录的事实,并将完整的URL传递给Joomla?

作为在IIS上安装Joomla的一部分,你可能(或者至less应该)已经创build了一个类似于这样的web.config:

<?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="(\&lt;|%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之前停止IIS检查现有文件和目录,应删除以下两行:

  <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" pattern="" ignoreCase="false" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" pattern="" ignoreCase="false" /> 

我得到的最好的答案来自StackOverflow