Jak przepisać indeks.php z Codeigniter na Windows Azure

Jak usunąć indeks.php w codeigniter na Windows Azure i IIS?

Czy mogę przepisać adres URL dla indeksu.php z Codeigniter bez konkretnego modułu?

Author: Mischa, 2012-04-01

3 answers

Możesz dodać reguły przepisywania w swojej sieci.plik konfiguracyjny. Dodaj do sekcji system.webServer:

<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> 
 14
Author: Mischa,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2012-04-01 15:01:35

Utwórz nazwę pliku web.config in wwwroot

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Imported Rule 1" stopProcessing="true">
                    <match url="^(.*)$" ignoreCase="false" />
                        <conditions logicalGrouping="MatchAll">
                            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        </conditions>
                        <action type="Rewrite" url="index.php?url={R:1}" appendQueryString="true" />
                </rule>
            </rules>
        </rewrite> 
    </system.webServer>
</configuration>
 10
Author: n9ti,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2012-12-03 10:37:46

Możesz również zaimplementować inne reguły przepisywania, takie jak

<rule name="a rule">
<match url="^xxx/(.*)/(.*)-(.*)\.xxx" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Rewrite" url="controller/method/{R:3}" />
</rule>

Jednym warunkiem jest zmiana $config ['url_protocal']= 'PATH_INFO'; w config / config.php to powie URL rewrite module używać re-writed URI zamiast oryginalnego URL, w przeciwnym razie będziesz miał 404 page not found problem.

 1
Author: user3124642,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2013-12-21 05:00:21