1
這裏是我的web.config文件。Url在codeigniter和IIS 8.5中的重寫問題
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<httpErrors errorMode="Detailed" />
<rewrite>
<rules>
<clear />
<rule name="Rewrite to index.php" enabled="true">
<match url="index.php|robots.txt|images|test.php" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="None" />
</rule>
<rule name="Rewrite CI Index" enabled="true" patternSyntax="ECMAScript" stopProcessing="true">
<match url=".*" ignoreCase="true" negate="false" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="true">
<add input="{REQUEST_URI}" pattern="bnrmcrz" />
<add input="{REQUEST_FILENAME}" pattern="css|js|jpg|jpeg|png|gif|ico|htm|html" negate="true" />
</conditions>
<action type="Rewrite" url="index.php/{R:0}" logRewrittenUrl="false" />
</rule>
</rules>
</rewrite>
<httpRedirect enabled="false" destination="" />
</system.webServer>
</configuration>
我需要一種方法來使URL不區分大小寫以及從中刪除index.php。
當我給「localhost/testProj」,它工作正常。下次我嘗試輸入「localhost/TESTproj」。它顯示未找到的頁面。我真正想要的是,不管文件夾名稱的提供方式如果拼寫相同,它應該將我重定向到同一個文件夾。
請幫我解決這個問題。
感謝
testProj是文件夾名稱(主代碼文件夾)。因爲它被設置爲defaultController,所以我沒有指定我的控制器。基本上,如果正確..路線只能從控制器名稱開始設置。如果錯了,糾正我。 – KloppForKop
太檢查你的URL和'base_url'的拼寫 –
拼寫沒有問題。我想要的是......用上面的規則... URL「http:// localhost/bnrmcrz」....給我應用程序的登錄頁面。此後我可以執行所有操作。但是,當我嘗試再次訪問相同的應用程序時,使用URL「http:// localhost/BNRMCRZ」或任何帶有不同情況組合的URL(與http:// localhost/bnrmcrz相比)。 ....它給了我一個錯誤,說「404錯誤...頁面未找到」。我實際上需要它重定向到相同的應用程序,而不考慮URL中使用的字母大小寫。我可以準確地找到錯誤的地方。 – KloppForKop