stu*_*rtb 6 windows iis rewrite codeigniter
我知道我可以使用以下web.config代码删除url的'index.php'部分:
<rewrite>
<rules>
<rule name="Rule" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
<add input="{URL}" pattern="^/favicon.ico$" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="index.php/{R:1}" appendQueryString="true" />
</rule>
</rules>
</rewrite>
Run Code Online (Sandbox Code Playgroud)
问题是我在子目录(mydomain.com/codeigniter)中安装了CI,并且我无法理解web.config文件.
你知道怎么改变它,所以它适用于子目录吗?
谢谢 :)
小智 14
我在根目录中有WordPress,在子目录中有我的CodeIgniter应用程序.我创建了一个类似于web.config你的类似的东西并将其保存在子目录中.我的CI应用程序不再需要url中的index.php.
起初,我加入我的子目录中<action url="myapp/index.php/{R:1}"...>,并希望它可以只限于看看子目录,但失败.我删除子目录,而让原来的,但移动web.config中的子目录和它的作品.
因此,我想,也许你可以创建不同的规则这两样东西的web.config文件,并在不同的目录中保存它们.
另一个注释可能会有所帮助:启用错误消息以从IIS输出详细信息.我使用这些技巧来了解IIS如何查找我的文件.它是<httpErrors errorMode="Detailed" />,<asp scriptErrorSentToBrowser="true"/>和以下<system.web>部分:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<httpErrors errorMode="Detailed" />
<asp scriptErrorSentToBrowser="true"/>
<rewrite>
<rules>
<rule name="RuleRemoveIndex" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="index.php/{R:1}" appendQueryString="true"/>
</rule>
</rules>
</rewrite>
</system.webServer>
<system.web>
<customErrors mode="Off"/>
<compilation debug="true"/>
</system.web>
</configuration>
Run Code Online (Sandbox Code Playgroud)
祝它有所帮助!
| 归档时间: |
|
| 查看次数: |
8115 次 |
| 最近记录: |