Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

301 redirect

#http to https and www to non-www
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www. [NC]
RewriteCond %{HTTP_HOST} ^(?:www.)?(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [L,NE,R=301]
Source by moz.com #
 
PREVIOUS NEXT
Tagged: #redirect
ADD COMMENT
Topic
Name
4+5 =