虛擬主機(jī)301重定向怎么做?虛擬主機(jī)301重定向制作,要分Linux虛擬主機(jī)和Windows虛擬主機(jī)。不同的操作系統(tǒng),301配置有不同。 301重定向,是一種非常重要的“自動(dòng)轉(zhuǎn)向”技術(shù)。比如,我們?cè)L問west.cn時(shí),出現(xiàn)的卻是 1、Linux系統(tǒng)虛擬主機(jī)301重定向怎么做 Linux虛擬主機(jī),一般偽靜態(tài)規(guī)則放入.htaccess文件: <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP:From-Https} !^on$ [NC] RewriteCond %{HTTP_HOST} ^(www.)?xxx.com$ [NC] RewriteRule ^(.*)$ 2、Windows系統(tǒng)虛擬主機(jī)301重定向怎么做 Windows虛擬主機(jī),一般偽靜態(tài)規(guī)則放入到web.config文件。 <?xml version=”1.0″ encoding=”UTF-8″?> <configuration> <system.webServer> <rewrite> <rules> <rule name=”301″ stopProcessing=”true”> <match url=”^(.*)$” ignoreCase=”false” /> <conditions logicalGrouping=”MatchAll”> <add input=”{HTTP_FROM_HTTPS}” pattern=”^on$” negate=”true” /> </conditions> <action type=”Redirect” url=” 當(dāng)然,除了以上的配置文件方式,我們也可以直接采用代碼方式: Windows虛擬主機(jī),ASP語言的: Response.Status=”301 Moved Permanently” Response.AddHeader “Location”,” header(“HTTP/1.1 301 Moved […]