最近在我的CI项目中设置了_auth。大部分情况下一切都很顺利。然而,当用户注销网站时,他们会被重定向到
http://网站/index.php/auth/login-
而不是预期的
http://网站/auth/login-
位置。这会导致登录时出现问题,因为登录后给出的位置是
http://网站/index.php
这是一个无效的位置。
服务器是IIS7,而不是Apache。在站点根目录的web.config中使用以下配置:
<system.webServer>
<directoryBrowse enabled="true" />
<defaultDocument>
<files>
<add value="index.php" />
</files>
</defaultDocument>
<rewrite>
<rules>
<rule name="Imported Rule 1" stopProcessing="true">
<match url="^(.*)" ignoreCase="false" />
<conditions logicalGrouping="MatchAny">
<add input="{QUERY_STRING}" pattern="base64_encode.*'(.*')" ignoreCase="false" />
<add input="{QUERY_STRING}" pattern="('<|%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="Imported Rule 2">
<match url="(.*)" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
<add input="{URL}" pattern="^/index.php" ignoreCase="true" negate="true" />
<add input="{URL}" pattern="(/component/)" ignoreCase="false" negate="true" />
<add input="{URL}" pattern="(/|'.php|'.html|'.htm|'.feed|'.pdf|'.raw|/[^.]*)$" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
您是否已从此配置项(在application/config/config.php中)中删除字符串index.php
?
$config['index_page'] = 'index.php';
应该是
$config['index_page'] = '';
重定向和uri生成都基于此值。