picocms / Pico

Pico is a stupidly simple, blazing fast, flat file CMS.
http://picocms.org/
MIT License
3.81k stars 615 forks source link

Pico & IIS .. 404 not found #175

Closed iamdex closed 9 years ago

iamdex commented 10 years ago

Hi, I've installed PICO under my IIS running in windows 8.1. The cms home page is displayed correctly, but I can't navigate under the sub page.. I'm getting a 404 Not Found error .. :(

Someone can help me?

PS: I'm getting the same error under my test site at http://www.davideespertini.it/pico/ But in this case the webserver is apache..

dannymarx commented 10 years ago

I have nearly the same problem. Her is the answer https://github.com/picocms/Pico/issues/55

ciolben commented 9 years ago

If you have IIS 8 or >, you can translate the .htaccess rewrite rules into web.config in your root folder like this:

.htaccess

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . index.php [L]
</IfModule>
Options -Indexes

into web.config

<configuration>
    <system.webServer>
        <!-- ... your config here ... -->
        <rewrite>
            <rules>
                <rule name="Imported Rule 1" 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" appendQueryString="true" />
                </rule>
            </rules>
        </rewrite>
        <directoryBrowse enabled="false" />
        <!-- ... your config here ... -->
    </system.webServer>
</configuration>

If you have an older version of IIS, you need the specifiy the rewrite section as follow before <system.webServer> :

<configSections>
    <sectionGroup name="system.webServer">
        <sectionGroup name="rewrite">
            <section name="rewriteMaps" overrideModeDefault="Allow" />
            <section name="rules" overrideModeDefault="Allow" />
        </sectionGroup>
    </sectionGroup>
</configSections>

You can find more help here.