laraveliisvirtual-directory

Laravel 6.0 IIS add virtual directory HTTP Error 404.0 - Not Found


I use IIS in windows 10 host run Laravel project and on the home page it working but I click login or register it not working?

This is my setup (add virtual directory) enter image description here

If localhost/tms It working but localhost/tms/login HTTP error 404


Solution

  • Thanks for contributing an answer This my answer

    Add the file web.config in public dir and paste th rules:

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <system.webServer>
            <rewrite>
            <rules>
                <rule name="Rule 1" stopProcessing="true">
                <match url="^(.*)/$" ignoreCase="false" />
                <action type="Redirect" redirectType="Permanent" url="/{R:1}" />
                </rule>
                <rule name="Rule 2" stopProcessing="true">
                <match url="^" ignoreCase="false" />
                <conditions>
                    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                </conditions>
                <action type="Rewrite" url="index.php" />
                </rule>
            </rules>
            </rewrite>
        </system.webServer>
    </configuration> 
    

    Credit by https://stackoverflow.com/a/45464268/8556614