<?xml version="1.0" encoding="utf-8"?>
<configuration>
	<system.webServer>
		<staticContent>
			<remove fileExtension=".svg" />
			<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
		</staticContent>
        	<httpErrors errorMode="Detailed">

            <remove statusCode="500" subStatusCode="-1" />
	            <error statusCode="500" subStatusCode="100" path="/standard/500-100.asp" responseMode="ExecuteURL" />
 		</httpErrors>
        	<defaultDocument>
	            <files>
                <clear />
                <add value="index.htm" />
                <add value="Index.php" />
                <add value="Default.asp" />
                <add value="Default.htm" />
                <add value="index.html" />
                <add value="iisstart.htm" />
                <add value="default.aspx" />
	            </files>
        	</defaultDocument>
		<rewrite>
			<rules>
		                <clear />
                		<rule name="AppSecure404Error" stopProcessing="true">
		                    <match url="secure/*" />
                 		   <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
		                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                		        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
		                    </conditions>
                		    <action type="Rewrite" url="secure/error404.asp" />
		                </rule>
		                <rule name="AppStd404Error" stopProcessing="true">
                		    <match url="standard/*" />
		                    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                		        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
		                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                		    </conditions>
		                    <action type="Rewrite" url="standard/error404.asp" />
                		</rule>
		                <rule name="WebPayrollSystem" stopProcessing="true">
		                    <match url="^t$" />
                 		   <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                        <add input="{HTTP_HOST}" pattern="^(www.|)webpayrollsystem\.co(\.uk|m)" />
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
		                    </conditions>
		                    <action type="Redirect" url="https://www.WebPayrollSystem.co.uk/WebPayrollSystem.asp" appendQueryString="false" logRewrittenUrl="true" />
		                </rule>
		                <rule name="MyPAYEDotCom" stopProcessing="true">
		                    <match url="(.*)" />
                 		   <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                        <add input="{HTTP_HOST}" pattern="^(www.|)mypaye\.com" />
		                    </conditions>
		                    <action type="Redirect" url="https://www.MyPAYE.co.uk/{R:1}" />
		                </rule>
		                <rule name="Main Rule" stopProcessing="true">
                		    <match url=".*" />
		                    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                		        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
		                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                		    </conditions>
		                    <action type="Rewrite" url="index.php" />
                		</rule>
			</rules>
                	<outboundRules>
                	    <rule name="SameSite rewrite">
                	        <match serverVariable="RESPONSE_Set_Cookie" pattern="(.*)=(.*)" negate="false" />
                	        <action type="Rewrite" value="{R:1}={R:2}; SameSite=None; HttpOnly; Secure" />
            	  	    </rule>
                	</outboundRules>
		</rewrite>
	</system.webServer>
</configuration>