I am migrating my web application from Apache 2.4.17 to Microsoft-IIS/7.5. In root of my application is .htaccess file which needs to be converted to Web.config.
After numerous attempts i am not able to do a successful conversion. Microsoft-IIS keeps returning 404 - file not found error. I have no experience in writing Web.config files so any help from a more experienced eye would be much appreciated.
Here is .htaccess file which is working fine on Apache:
php_value post_max_size 70M
RewriteEngine on
# In case router is called do nothing
RewriteRule ^framework/Router.php(.)*$ - [L]
# Prevents user from making a request to a specific .php file
RewriteRule ^[A-Za-z/]+.php$ - [F,L]
# Application index page
RewriteRule ^$ domov [L]
# Redirect everything else to Router.php
RewriteRule ^[A-Za-z/]+$ framework/Router.php [L]
RewriteRule ^([A-Za-z/]+)([0-9]+)$ framework/Router.php?id=$2 [L]
RewriteRule ^([A-Za-z/]+)/(page=[0-9]+)$ framework/Router.php?$2 [L]
And here is my attempt on writing Web.config file:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="rule 1G" stopProcessing="true">
<match url="^framework/Router.php(.)*$"/>
<action type="Rewrite" url="/-" />
</rule>
<rule name="rule 2G" stopProcessing="true">
<match url="^[A-Za-z/]+.php$" />
<action type="Rewrite" url="/-"/>
</rule>
<rule name="rule 3G" stopProcessing="true">
<match url="^$" />
<action type="Rewrite" url="/domov"/>
</rule>
<rule name="rule 4G" stopProcessing="true">
<match url="^[A-Za-z/]+$" />
<action type="Rewrite" url="/framework/Router.php"/>
</rule>
<rule name="rule 5G" stopProcessing="true">
<match url="^([A-Za-z/]+)([0-9]+)$" />
<action type="Rewrite" url="/framework/Router.php?id={R:2}" appendQueryString="true" />
</rule>
<rule name="rule 6G" stopProcessing="true">
<match url="^([A-Za-z/]+)/(page=[0-9]+)$" />
<action type="Rewrite" url="/framework/Router.php?{R:2}" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>