I have a PHP site deployed on IIS 7 and using URL Rewrite module but my rewrite rules are not working. Below are my actual url and urls I want to show in browser:
Browser URL : http://mydomain.com/myfolder or http://mydomain.com/myfolder/anytext
Actual URL : http://mydomain.com/myfolder/myfile.html
Previously I was using mod rewrite with .htaccess on Wamp server and below are the working rules which were defined in .htaccess file
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^(.+)/$
RewriteRule ^(.+)/$ /$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^.*$ myfile.html [L]
Below is my web.config file which is not working, Please suggest and help to resolve my problem
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Rewrite to myfile.html1">
<match url="^(.+)/$" />
<action type="Rewrite" url="/$1" />
</rule>
</rules>
<rules>
<rule name="Rewrite to myfile.html2">
<match url="^.*$" />
<action type="Rewrite" url="myfile.html" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>