我如何重寫URL每一頁上,如下所示:如何重寫網址(例如website.com到www.website.com)?
website.com
到www.website.com
website.com/page1.aspx
到www.website.com/page1.aspx
- 等
我如何重寫URL每一頁上,如下所示:如何重寫網址(例如website.com到www.website.com)?
website.com
到www.website.com
website.com/page1.aspx
到www.website.com/page1.aspx
好,如果我們談論的Apache,然後英寸htaccess
RewriteEngine on
RewriteCond %{HTTP_HOST} ^website\.com [NC]
RewriteRule ^(.*)$ http://www.website.com/$1 [L,R=301]
IIS和web.config中去
<rewrite>
<rules>
<rule name="Canonical Host Name" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTP_HOST}" pattern="^www\.website\.com$" negate="true" />
</conditions>
<action type="Redirect" url="{MapSSL:{HTTPS}}www.website.com/{R:1}" redirectType="Permanent" />
</rule>
</rules>
<rewriteMaps>
<rewriteMap name="MapSSL" defaultValue="OFF">
<add key="ON" value="https://" />
<add key="OFF" value="http://" />
</rewriteMap>
</rewriteMaps>
</rewrite>
ASP.NET C#,我認爲是什麼解決方案是一個規則重寫就像在web.config中,但我似乎無法找到它 – 2013-05-06 02:17:12
好吧我調整它爲iis也 – Drew 2013-05-06 02:26:33
「500頁錯誤」後,我有它web.config中,我會更多地看到它,看看我是否可以修復它 – 2013-05-06 18:00:16
IIS確實有一個重寫模塊,讓你做你想做什麼http://www.iis.net/downloads/microsoft/url-rewrite。
安裝後重寫的代碼是什麼? – 2013-05-06 02:18:03
使用apache? – Drew 2013-05-06 01:11:43
「重寫」是什麼意思? – 2013-05-06 01:12:21