окт. 23, 2023
行業(yè)資訊
0
可用的301重定向規(guī)則,
不帶www的域名重定向到帶www
不是https的域名重定向到https
ErrorDocument 404 /404.html
ErrorDocument 403 /403.html
RewriteEngine On
# ensure www.
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# ensure https
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
上邊那個是強制跳轉(zhuǎn)所有的子域名
需要指定域名才跳轉(zhuǎn)使用以下代碼:
# ensure www.
RewriteCond %{HTTP_HOST} ^jeawin.com [NC]
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# ensure https
RewriteCond %{HTTP_HOST} ^www.fushitang.cn [NC]
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
不帶www的域名重定向到帶www
不是https的域名重定向到https
ErrorDocument 404 /404.html
ErrorDocument 403 /403.html
RewriteEngine On
# ensure www.
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# ensure https
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
上邊那個是強制跳轉(zhuǎn)所有的子域名
需要指定域名才跳轉(zhuǎn)使用以下代碼:
# ensure www.
RewriteCond %{HTTP_HOST} ^jeawin.com [NC]
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# ensure https
RewriteCond %{HTTP_HOST} ^www.fushitang.cn [NC]
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
News
行業(yè)資訊
обратно к списку
о авторе
JEAWIN
JEAWIN,在外貿(mào)B2B營銷領(lǐng)域已有二十年的經(jīng)驗,擔(dān)任過編輯、SEO,數(shù)據(jù)分析師和營銷主管。他1998年就開始接觸互聯(lián)網(wǎng),曾在Thomas,GlobalSpec等國際知名工業(yè)B2B營銷公司(大中華區(qū))任職工作,2011年創(chuàng)建廈門杰贏網(wǎng)絡(luò)科技有限公司,為中國外貿(mào)企業(yè)提供高性價比品牌營銷服務(wù),尤其擅長工業(yè)品營銷和Google SEO營銷。
