Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to use Laravel in Windows IIS

Laravel 4 in Windows Server IIS

###1. Put this web.config in laravel root diretory

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
		<defaultDocument>
			<files>
				<clear />
				<add value="index.php" />
				<add value="default.aspx" />
				<add value="Default.htm" />
				<add value="Default.asp" />
				<add value="index.htm" />
				<add value="index.html" />
			</files>
		</defaultDocument>
		<handlers accessPolicy="Read, Execute, Script" />
		<rewrite>
			<rules>
				<rule name="Imported Rule 3" stopProcessing="true">
					<match url="^(.*)$" ignoreCase="false" />
					<conditions logicalGrouping="MatchAll">
						<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="public/index.php/{R:1}" />
				</rule>
			</rules>
		</rewrite>
	</system.webServer>
</configuration>

###2. Done. Don't move the public folder or any file :)

@d3n1c1d3

This comment has been minimized.

Copy link

@d3n1c1d3 d3n1c1d3 commented Apr 3, 2014

I got in IIS 8 an internal server error caused from the line

<handlers accessPolicy="Read, Execute, Script" />

after removing it laravel just showed up like expected.

I also moved the web.config file into my public directory. so the basic configuration for apache and IIS is stored in the same directory. and i dont have to look around somewhere else (and also for security reasons). for this i had to modify the followin line

<action type="Rewrite" url="public/index.php/{R:1}" />

into :

<action type="Rewrite" url="index.php/{R:1}" />

anyway, leandro thanks for providing the web.config file for IIS. you made my day.

@RaffaeleT

This comment has been minimized.

Copy link

@RaffaeleT RaffaeleT commented May 26, 2014

Thank you Leandro

@brcontainer

This comment has been minimized.

Copy link

@brcontainer brcontainer commented Mar 13, 2016

Thanks! Work fine in IIS Express for several frameworks like Laravel and Laravel5 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.