Skip to main content Help Control Panel

NGRhodes

NickR's website

More in Blog

NGRhodes.co.uk htaccess domain redirects the easy way

I have decided to update my domain to www.NGRhodes.co.uk . My motivation for doing this was simply picking something that is more memorable, rolls off the tongue easier, but at the same time not too dissimilar to my previous domain name.

I had a quick look for .htaccess rules and found one simple easy way to redirect any domain and redirect the canonical non-www to www.

RewriteCond %{HTTP_HOST} !^www.domain.com$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]


(from redirect www and no www)

This rule simply redirects anything that is NOT my desired domain name to my domain name.
Share
Information channels
Recent files