注册 登录
编程论坛 Linux教室

什么是301重定向,如何操作

岛鲸 发布于 2017-06-15 12:16, 4077 次点击

ISAPI Rewrite 3 几个常用 301 重定向规则
ISAPI Rewrite 不同版本的规则略有差别,这个帮助文件中有较详细的规则参考,附几个常用的写法:
下面的301规则仅适用于 ISAPI Rewrite 3,其他版本请勿使用!
1、将“”301重定向到“www.
RewriteEngine on
RewriteCond %{HTTPS} (on)?
RewriteCond %{HTTP:Host} ^(?!www.)(.+)$ [NC]
RewriteCond %{REQUEST_URI} (.+)
RewriteRule .? http(?%1s)://www.%2%3 [R=301,L]
2、301重定向到另一个域名
RewriteCond %{HTTP:Host} ^www.
RewriteRule (.*) http://www. [NC,R=301]
3、301重定向单个页面
RewriteRule ^/oldpage.htm$ http://www. [R=301,L]
将以上代复制到记事本内并保存为.htaccess文件上传到你的空间WEB下即可!
1 回复
#2
俺是你大爷2019-03-12 12:42
301重定向:原网页或内容被永久性的搬迁到他处。

Apache的话,设置.htaccess文件,网上教程很多。
Nginx同理分析。301重定向常用来将将老域名指代的东西重新指向新的网页内容,
和CNAME不同,301重定向是不会对原网站的流量排名、权重等造成不良影响的,基本上不会对SEO有什么影响。
GMTYDetect languageAfrikaansAlbanianAmharicArabicArmenianAzerbaijaniBasqueBelarusianBengaliBosnianBulgarianCatalanCebuanoChichewaChinese (Simplified)Chinese (Traditional)CorsicanCroatianCzechDanishDutchEnglishEsperantoEstonianFilipinoFinnishFrenchFrisianGalicianGeorgianGermanGreekGujaratiHaitian CreoleHausaHawaiianHebrewHindiHmongHungarianIcelandicIgboIndonesianIrishItalianJapaneseJavaneseKannadaKazakhKhmerKoreanKurdishKyrgyzLaoLatinLatvianLithuanianLuxembourgishMacedonianMalagasyMalayMalayalamMalteseMaoriMarathiMongolianMyanmar (Burmese)NepaliNorwegianPashtoPersianPolishPortuguesePunjabiRomanianRussianSamoanScots GaelicSerbianSesothoShonaSindhiSinhalaSlovakSlovenianSomaliSpanishSundaneseSwahiliSwedishTajikTamilTeluguThaiTurkishUkrainianUrduUzbekVietnameseWelshXhosaYiddishYorubaZuluAfrikaansAlbanianAmharicArabicArmenianAzerbaijaniBasqueBelarusianBengaliBosnianBulgarianCatalanCebuanoChichewaChinese (Simplified)Chinese (Traditional)CorsicanCroatianCzechDanishDutchEnglishEsperantoEstonianFilipinoFinnishFrenchFrisianGalicianGeorgianGermanGreekGujaratiHaitian CreoleHausaHawaiianHebrewHindiHmongHungarianIcelandicIgboIndonesianIrishItalianJapaneseJavaneseKannadaKazakhKhmerKoreanKurdishKyrgyzLaoLatinLatvianLithuanianLuxembourgishMacedonianMalagasyMalayMalayalamMalteseMaoriMarathiMongolianMyanmar (Burmese)NepaliNorwegianPashtoPersianPolishPortuguesePunjabiRomanianRussianSamoanScots GaelicSerbianSesothoShonaSindhiSinhalaSlovakSlovenianSomaliSpanishSundaneseSwahiliSwedishTajikTamilTeluguThaiTurkishUkrainianUrduUzbekVietnameseWelshXhosaYiddishYorubaZuluText-to-speech function is limited to 200 charactersOptions : History : Feedback : DonateClose
1