1

I would like to make an existing PHP Website (Apache) run on a virtual folder under IIS 8.5.

With the help of some nice online tools I translated the following .htaccess content:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

to web.config:

<rule name="rule 1" stopProcessing="true">
  <match url="^index\.php$"  />
  <action type="Rewrite" url="/-"  />
</rule>
<rule name="rule 2" stopProcessing="true">
  <match url="."  />
  <action type="Rewrite" url="//index.php"  />
</rule>

This works fine for some URL like http://www.my_new_website.com/.

However, my goal is to make this Website run in a virtual directory below an ASP.NET web application, e.g. http://www.my_asp_net_website/php_app/. Therefore I created a Virtual Directory "php_app" in IIS Manager pointing to directory C:\ ... \\myphpdir as I would do for an ASP.NET application.

Now I must adapt my web.config; but as I am not very familiar with redirect / rewrite rules and regular expressions, I ask you:

What are the correct rewrite rules in web.config?

All I tried until now resulted in some missing .css or 404 errors.

0 Answers0