1

I am configuring Laravel 5 on IIS. Whenever I am trying to access any URL it gives 404 error. There is some issue with .htaccess file so I am using web.config file. Here is my web.config file code:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Laravel4" 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" appendQueryString="true" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

And here is my .htaccess file code:

 <IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes...
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

I have placed this file on my root folder (public folder) but it's still not working. Is there any solutions?

Mike Rockétt
  • 8,947
  • 4
  • 45
  • 81

1 Answers1

1

I have found the solution.

If you have tried all the possible things to resolve .htaccess or web.config file issue and again it's not working than uninstall URL Rewrite module from your server's control panel and reinstall it. It will definitely work. And make sure you have installed URL Rewrite 2.0 for IIS 7.

  • this fix mine too. i was shocked that it was solved with a simple solution as this. thank you [+1] – kapitan Mar 18 '21 at 03:57