【发布时间】:2011-03-27 15:40:15
【问题描述】:
我安装了 CodeIgniter。基本上,我的目录结构是这样的:
| webroot
|- ci_apps
|-- application1
|-- application2
| ci_system
| index.php
| testing.php
现在,我只能加载一个应用程序,它是在 index.php 中定义的。我想做的是能够将 index.php 重命名为 application1.php 和 application2.php。现在问题来了:
我希望能够在不输入 .php 的情况下转到 http://website.com/application1。
如何使用 IIS URL 重写来实现这一点?我的 web.config 文件如下所示:
<rule name="ci_rule_01" stopProcessing="true">
<match url="(index.php|robots.txt|sitemap.xml|extras|info.php|favicon.ico|delorie.html|testing.php)" />
</rule>
<rule name="ci_rule_02">
<match url="(.*)" />
<action type="Rewrite" url="index.php/{r:1}" appendQueryString="false" />
</rule>
这在我使用 index.php 时有效(它隐藏了 index.php)。但是我将如何改变它以使用像 application1.php 这样的文件?我似乎无法让它正常工作。我希望http://website.com/ 使用 index.php(但仍然隐藏它),我希望 http://website.com/application1 加载 application1.php。
【问题讨论】:
标签: iis codeigniter url-rewriting