How to Set Up Domain Redirection

Domain redirection automatically sends visitors from one web address to another. This article shows you how to set it up in cPanel and DirectAdmin, the two control panels used on Hostking hosting plans. Common uses include:

  • Redirecting http:// to https:// after installing an SSL certificate
  • Redirecting www.yourdomain.com to yourdomain.com or vice versa
  • Redirecting an old page URL to a new one after a site redesign
  • Redirecting one domain to your main website

Redirect types: 301 vs 302

301 — Permanent redirect
Tells search engines and browsers the page has permanently moved. Use this for most redirects — it updates visitors' bookmarks and passes SEO value to the new URL.

302 — Temporary redirect
Use this only if you intend to restore the original URL later. Search engines keep indexing the original page, and bookmarks are not updated.


Redirect vs parked domain

A redirect changes the address bar in the visitor's browser — they end up on the new URL. A parked domain (called a "Domain Pointer" in DirectAdmin, or an alias in cPanel) shows the same website content under a second domain name, but the address bar usually still shows the second domain, not a redirected URL. If you want visitors to end up on a different, visible web address, you need a redirect, not a parked domain.


Set up a redirect in cPanel

If your plan uses cPanel, use the built-in Redirects feature. This writes the redirect rule into your site's .htaccess file for you.

  1. Log in to cPanel and, under the Domains section, open Redirects.
  2. Choose the redirect Type: Permanent (301) for most cases, or Temporary (302) if the change is short-term.
  3. Select the domain to redirect from the drop-down, or choose All Public Domains to redirect every domain on the account.
  4. Optional: in the path field, enter the specific page or folder to redirect. Leave it blank to redirect the whole site.
  5. In Redirects to, enter the full destination URL, including http:// or https://.
  6. Choose how to handle www: Redirect with or without www (the usual choice), Only redirect with www, or Do Not Redirect www.
  7. Optional: tick Wild Card Redirect if you want every page under the old path to redirect to the matching page under the new path (for example, /recipes/apple-pie.php to /food/apple-pie.php).
  8. Click Add.

Your new redirect appears under Current Redirects at the bottom of the page. To remove a redirect, find it in this list and click Delete.


Set up a redirect in DirectAdmin

Site redirection (true 301/302 redirect)

Use this when you want the visitor's address bar to change to the new URL.

  1. Log in to DirectAdmin and go to Account Manager, then Site Redirection (the exact wording may vary slightly depending on your DirectAdmin theme).
  2. Click to add a new redirect and choose the domain from the Local URL Path field.
  3. If you only want to redirect a specific folder, enter it after the slash. Leave it blank to redirect the whole domain.
  4. Choose the redirect type: Permanent (301) or Temporary (302).
  5. Enter the full Destination URL, including the protocol.
  6. Click Create.

Force www or non-www redirect

To make your whole domain always load with or without the www prefix, go to Domain Setup, select the domain, and use the Force Redirect option. You can choose force_redirect=www, force_redirect=non-www, or turn it off. This setting is off by default because it can cause redirect loops if misconfigured, so check your site loads correctly after enabling it.

Domain Pointers (parking, not a redirect)

A Domain Pointer makes a second domain show the same content as your main site, using the same files, without creating duplicate pages. It is not a true redirect: in most setups the address bar still shows the pointed domain rather than changing to your main domain.

  1. In DirectAdmin, go to Account Manager → Domain Pointers (classic theme) or Advanced Tools → Domain Pointers (Enhanced theme).
  2. Click Create Domain Pointer.
  3. Enter the Source Domain (the one to park) and select the Target Domain.
  4. Tick Create as an Alias if you want the source domain treated as an alias of the target.
  5. Click Create.

Before setting up a Domain Pointer, make sure the pointed domain's nameservers or DNS A record already point to your hosting account — it cannot point to the same nameservers used by your primary domain. Changes can take up to 24 hours to take effect while DNS updates propagate worldwide.


Redirect using .htaccess

For more control than the control panel tools offer, add rules directly to your .htaccess file. Access it through File Manager in your public_html folder (enable "show hidden files" if you can't see it).

Redirect HTTP to HTTPS:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Redirect www to non-www:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]

Redirect a specific old page to a new URL:

Redirect 301 /old-page https://www.yourdomain.com/new-page

Troubleshooting redirects

  • Always back up your .htaccess file before editing it — a mistake can take your website offline.
  • Clear your browser cache, or test in a private/incognito window, after setting up a redirect.
  • If you see "Too many redirects", you have a redirect loop — check your redirect and any Force Redirect or www settings, as they can conflict with each other.
  • If a Domain Pointer doesn't appear to work, confirm the pointed domain's DNS has finished propagating — allow up to 24 hours.
  • Always include the protocol (http:// or https://) in the destination field — redirects without one often fail to work as expected.

Need help?

Not sure which control panel your hosting plan uses, or want help choosing between a redirect and a parked domain? Contact our support team via live chat on the Hostking website or by opening a support ticket in the client area.

Was this answer helpful? 0 Users Found This Useful (0 Votes)