【问题标题】:Complicated URL Rewrite. Rewriting index.php, yet wanting to rewrite other.php to load without extension复杂的 URL 重写。重写 index.php,但又想重写 other.php 以在没有扩展的情况下加载
【发布时间】: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


    【解决方案1】:

    你看过这个吗? http://codeigniter.com/wiki/Multiple_Applications

    然后,您的重写规则只需要从您的 url 中排除 *.php。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-06-14
      • 2020-01-22
      • 1970-01-01
      • 1970-01-01
      • 2014-07-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多