ion_auth adds unnecessary index.php in HTTP location
-
22-06-2021 - |
Pergunta
Recently setup ion_auth in my CI project. Everything is working well for the most part. However, when the user logs out of the web site, they are redirected to
http://website/index.php/auth/login
instead of the expected
http://website/auth/login
location. This causes an issue upon signing in as the location given after login is
http://website/index.php/website
which is an invalid location.
The server is IIS7 and not Apache. Using the configuration below in the web.config at the root of the site:
<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>
Solução
Have you removed the string index.php
from this config item (in application/config/config.php)?
$config['index_page'] = 'index.php';
should be
$config['index_page'] = '';
Redirects and uri generation are based upon this value.
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow