Link Web and COVID-19. Click here.

Common .htaccess redirect rules

Redirect non-www to www

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTP_HOST} ^yourdomain.com
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Redirect http to https

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^yourdomain.com
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Redirect old domain to a single page

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{http_host} ^olddomain.com
RewriteCond %{http_host} ^www.olddomain.com
RewriteRule (.*) https://www.newdomain.com/new-page/ [R=301,L]

© Copyright Link Web Development Ltd. 2020
Follow Us: