I have a rewrite rule for Apache and a Nginx version. Both should be same.
URL Rewrite rules:
Apache
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
Nginx
location / {
try_files $uri $uri/ /index.php?$query_string;
}
Now I have to host my site on a IIS server. How do I transfer this rule.
According to your description, I suggest you could try to use below IIS url rewrite rule:
Notice: If you want to use url rewrite in the IIS, you should install the url rewrite extension in below url : https://www.iis.net/downloads/microsoft/url-rewrite
<rewrite>
<rules>
<rule name="Imported Rule 1" stopProcessing="true">
<match url=".*" ignoreCase="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.