htaccess 301 Redirection Rules

Oct 23, 2023
Industry information
0
可用的301重定向规则,
不带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]
Nickname*:
E-mail*:
Rate*:
Comments*:
About the author
JEAWIN
JEAWIN
JEAWIN,在外贸B2B营销领域已有二十年的经验,担任过编辑、SEO,数据分析师和营销主管。他1998年就开始接触互联网,曾在Thomas,GlobalSpec等国际知名工业B2B营销公司(大中华区)任职工作,2011年创建厦门杰赢网络科技有限公司,为中国外贸企业提供高性价比品牌营销服务,尤其擅长工业品营销和Google SEO营销。

If you need to get in touch with us, here are our contact details

If you need to get in touch with us, here are our contact details
Contact number
Contact email
WeChat Contact
Jieying Network
QQ