Redirect a page or domain

redirect, 301, 302, htaccess, seo, domain · 0 found this helpful

A redirect sends visitors, and search engines, from one address to another. Use one when you rename a page, change domains, or retire an old site.

Which type

Code Meaning Use when
301 Moved permanently The old address is gone for good. Search engines pass ranking to the new one
302 Moved temporarily You'll bring the old address back (a sale page, maintenance)

Option 1: Redirects in your account (no code)

  1. Open Account → Hosting → your site → Websites and find Redirects. Click Add redirect.
  2. Pick the Domain.
  3. Under From path, type the old path, for example /old-menu. Leave it blank to redirect the whole domain.
  4. Under To, enter the full new address: https://example.ca/menu.
  5. Set Kind to Permanent (301), and choose whether it Applies to both the www and non-www address.
  6. Tick Also redirect everything under this path to the same place only if every page below the path should follow.
  7. Click Add redirect.
Redirects, with one redirect from /menu

We write the rule into .htaccess for you. To remove a redirect, click Delete next to it in the list.

Option 2: Rules in .htaccess

Edit public_html/.htaccess in Files (see .htaccess basics). Back it up first.

# Single page, permanent
Redirect 301 /old-menu https://example.ca/menu

# Single page, temporary
Redirect 302 /spring-sale https://example.ca/sale

# Whole folder to a new folder (keeps the rest of the path)
RedirectMatch 301 ^/news/(.*)$ https://example.ca/blog/$1

# Pattern rule with mod_rewrite: old .html pages to clean URLs
RewriteEngine On
RewriteRule ^(.+)\.html$ /$1 [R=301,L]

# Whole old domain to a new domain, keeping paths
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?oldbakery\.ca$ [NC]
RewriteRule ^(.*)$ https://example.ca/$1 [R=301,L]

For the last rule, the old domain must be added to your account and share this folder. See Domain aliases.

Test it

curl -I https://example.ca/old-menu

Look for HTTP/2 301 and a location: line with your new address.

If something goes wrong

  • Redirect loop ("too many redirects"): the target redirects back. Check your HTTPS and www rules. See Force HTTPS.
  • Still shows the old page: your browser cached it. Try a private window.
  • WordPress: put your rules above the # BEGIN WordPress block so they run first.
  • 500 error after editing: a typo. Restore your backup copy of .htaccess.

Was this helpful?

Still stuck? Ask us and we'll walk you through it.