# How i Solve problems on IIS (500 and 404)

**URL:** <https://forum.mautic.org/t/how-i-solve-problems-on-iis-500-and-404/3802>\
**Category:** Product Support\
**Created:** [May 17, 2016, 7:52pm UTC](https://forum.mautic.org/t/how-i-solve-problems-on-iis-500-and-404/3802 "2016-05-17T19:52:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![yambroskin](https://avatars.discourse-cdn.com/v4/letter/y/7feea3/32.png) [@yambroskin](https://forum.mautic.org/u/yambroskin)\
**Post date:** [May 17, 2016, 7:52pm UTC](https://forum.mautic.org/t/how-i-solve-problems-on-iis-500-and-404/3802/1 "2016-05-17T19:52:01Z")

</div>

1. install php 5.6 - mautic supported use guide on [php.net](http://php.net/manual/en/install.windows.iis7.php)  
2. enable all extensions and use php.ini-production (you can disable some extesions after start)  
  
  
  
3.you need import .htaccess file  

Code:

 RewriteEngine On

```
RewriteCond %{HTTP:Authorization} .+
RewriteRule .* - [HTTP_AUTHORIZATION:%{HTTP:Authorization}]

RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::2$
RewriteRule ^(.*) - [BASE:%1]

RewriteCond %{REDIRECT_STATUS} ^$
RewriteRule ^index.php(/(.*)|$) %{BASE}/$2 [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f
RewriteRule .? - [L]

# Rewrite all other queries to the front controller.
RewriteRule .? %{BASE}/index.php [L]

```

\<IfModule !mod\_rewrite.c\>

```
    RedirectMatch 302 ^(?!/(index.php|index_dev.php|app|addons|plugins|media|upgrade))(/(.*))$ /index.php$2
   
</IfModule>

```

  
or use my web.config file on mautic folder  

Code:

\<?xml version="1.0" encoding="UTF-8"?\> 

```
</system.webServer>

```

  
before change this settings i was 500 errors and 404

---

<div class="post-metadata">

**Author:** ![yambroskin](https://avatars.discourse-cdn.com/v4/letter/y/7feea3/32.png) [@yambroskin](https://forum.mautic.org/u/yambroskin)\
**Post date:** [May 17, 2016, 7:52pm UTC](https://forum.mautic.org/t/how-i-solve-problems-on-iis-500-and-404/3802/2 "2016-05-17T19:52:01Z")

</div>

1. install php 5.6 - mautic supported use guide on [php.net](http://php.net/manual/en/install.windows.iis7.php)
2. enable all extensions and use php.ini-production (you can disable some extesions after start)

3.you need import .htaccess file

```auto
<IfModule mod_rewrite.c>
    RewriteEngine On

   
    RewriteCond %{HTTP:Authorization} .+
    RewriteRule .* - [HTTP_AUTHORIZATION:%{HTTP:Authorization}]

   
    RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::2$
    RewriteRule ^(.*) - [BASE:%1]

    
    RewriteCond %{REDIRECT_STATUS} ^$
    RewriteRule ^index.php(/(.*)|$) %{BASE}/$2 [R=301,L]

  
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule .? - [L]

    # Rewrite all other queries to the front controller.
    RewriteRule .? %{BASE}/index.php [L]
</IfModule>

<IfModule !mod_rewrite.c>
    <IfModule mod_alias.c>
       
        RedirectMatch 302 ^(?!/(index.php|index_dev.php|app|addons|plugins|media|upgrade))(/(.*))$ /index.php$2
       
    </IfModule>
</IfModule>
```

or use my web.config file on mautic folder

```auto
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <handlers>
            <add name="FastCGI" path="*.php" verb="*" modules="FastCgiModule" scriptProcessor="C:phpphp-cgi.exe" resourceType="Either" requireAccess="Script" />
        </handlers>
        <defaultDocument>
            <files>
                <add value="index.php" />
            </files>
        </defaultDocument>
        <rewrite>
            <rules>
                <rule name="Импортированное правило 1">
                    <match url=".*" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{HTTP_AUTHORIZATION}" pattern=".+" ignoreCase="false" />
                    </conditions>
                    <action type="None" />
                </rule>
                <rule name="Импортированное правило 2">
                    <match url="^(.*)" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{URL}::{R:1}" pattern="^(/.+)/(.*)::2$" ignoreCase="false" />
                    </conditions>
                    <action type="None" />
                </rule>
                <rule name="Импортированное правило 3" stopProcessing="true">
                    <match url="^index.php(/(.*)|$)" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REDIRECT_STATUS}" pattern="^$" ignoreCase="false" />
                    </conditions>
                    <action type="Redirect" url="{BASE}/{R:2}" redirectType="Permanent" />
                </rule>
                <rule name="Импортированное правило 4" stopProcessing="true">
                    <match url=".?" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" />
                    </conditions>
                    <action type="None" />
                </rule>
                <rule name="Импортированное правило 5" stopProcessing="true">
                    <match url=".?" ignoreCase="false" />
                    <action type="Rewrite" url="{BASE}/index.php" />
                </rule>
            </rules>
        </rewrite>
       
    </system.webServer>
    
</configuration>

```

before change this settings i was 500 errors and 404

---

<div class="post-metadata">

**Author:** ![kongocat](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/kongocat/32/8931_2.png) [@kongocat](https://forum.mautic.org/u/kongocat)\
**Post date:** [December 24, 2022, 7:39pm UTC](https://forum.mautic.org/t/how-i-solve-problems-on-iis-500-and-404/3802/3 "2022-12-24T19:39:29Z")

</div>

Hi,

I see your post from 2016 so thanks!

Is it still the same code today for newer 4.XX versions?

Thanks
