Using .htaccess to redirect an entire domain

Every so often I need to redirect from one domain to another. Maybe I’m configuring both a .com and .co.uk domain to point to just one of them. Maybe I need to redirect an directory/path to a different domain as part of a site migration or segmentation (e.g. redirecting https://example.com/account to https://account.example.com). Response codes Before setting up a redirect, make sure you know what kind of redirect you want. There are several different response codes which change how search engines (e.g. Google) behave when the see the redirect. ...

29 June 2025