PHP rewriting URLs using htaccess and rewriting Microsoft IIS URLs

I'm used to working with Apache servers, so when mod_rewrite is enabled, I can create an htaccess file and use URL rewriting.

Here is my htaccess file:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

Now I created this site that uses this URL rewriting module, but I came to find out that this is a Microsoft server. Can i use htaccess file? Is there something I need to change to get it working? How do I know if URL rewriting is configured on a Microsoft server?

+5
source share
4 answers
+5

IIS 7, URL- IIS, " " , mod_rewrite URL- IIS. , RewriteCond "-s" "-l", , URL . , :

RewriteCond %{REQUEST_FILENAME} -f [OR]

IIS URL Rewrite UI. :

<rewrite>
  <rules>
    <rule name="Imported Rule 1" stopProcessing="true">
      <match url="^.*$" />
      <conditions logicalGrouping="MatchAny">
        <add input="{REQUEST_FILENAME}" matchType="IsFile"  />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory"  />
      </conditions>
      <action type="None" />
    </rule>
    <rule name="Imported Rule 2" stopProcessing="true">
      <match url="^.*$" />
      <action type="Rewrite" url="index.php" />
    </rule>
  </rules>
</rewrite>
+10

.htaccess - Apache Apache, IIS (Microsoft). , Apache Windows.

IIS7 URL-, URL-. ISAPI_Rewrite, IIS. , (.. htaccess)

+4

You can use the above configuration, as in ISAPI_Rewrite 3, or Helicon Ape products .

0
source

All Articles