[英]How to convert a .htaccess to web.config?
我必須將htaccess轉換為web.config。
主要重定向是刪除舊的.aspx擴展名。 然后是幾個重命名文件的重定向。
htaccess的:
<IfModule mod_rewrite.c>
RewriteEngine On
# redirect aspx to extensionless
RewriteRule ^(.+)\.aspx$ $1 [NC,L,R=301]
# old page redirects
Redirect 301 /folder/old-file http://www.website.com/new-file
Redirect 301 /folder/old-file-2 http://www.website.com/new-file-2
</IfModule>
在IIS中,此規則將是:
<rule name="redirect aspx to extensionless" stopProcessing="true">
<match url="^(.+)\.aspx$" />
<action type="Redirect" url="{R:1}" />
</rule>
<rule name="old 1" stopProcessing="true">
<match url="^folder/old-file$" />
<action type="Redirect" url="http://www.website.com/new-file" />
</rule>
<rule name="old 2" stopProcessing="true">
<match url="^folder/old-file-2$" />
<action type="Redirect" url="http://www.website.com/new-file-2" />
</rule>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.