I have installed laravel on windows server (using IIS 8.5) and I am having issues removing the public folder from the URL. I managed to make laravel's public folder as my domain's root folder which solved this issue, however, on form submit via ajax I am unable to remove the public folder from the url. For example:
my domain is www.abc.com and I have a form, which on submit needs to post to www.abc.com/login. But I get 404 error if I don't include the public in the url. If I send a ajax request to www.abc.com/public/login, it works perfectly fine.
I also add my web.config files:
1. outside public folder( in httpdocs folder)
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Imported Rule 11" stopProcessing="true">
<match url="^(.*)/$" ignoreCase="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
</conditions>
<action type="Redirect" redirectType="Permanent" url="/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
2. inside public folder
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Imported Rule 1" stopProcessing="true">
<match url="^(.*)/$" ignoreCase="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
</conditions>
<action type="Redirect" redirectType="Permanent" url="/{R:1}"/>
</rule>
<rule name="Imported 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>
I spent 12 hours searching many forums but couldn't get any solution. Any help will be highly appreciated as I am really stuck. Thanks