I have the following IIS URL Rewrite rules in web.config:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="some-name" patternSyntax="Wildcard">
<match url="*"/>
<conditions>
<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>
</rewrite>
</system.webServer>
</configuration>
They work for any subfolder, like this:
Case A
web.config and index.php are stored in folder1/test:
Request /folder1/test/some/virtual/12-url is sent to folder1/test/index.php.
Case B
web.config and index.php are stored in folder2/wherever/this:
Request /folder2/wherever/this/virtual/12-url is sent to folder2/wherever/this/index.php.
For switching to Apache, how can these rules be rewritten so that there is no need to update .htaccess whenever the subfolder URL changes? (The project may be hosted on any subfolder, does not require to be placed in Document Root.)