How to Set Up a URL Redirect for Your Domain

A URL redirect automatically sends visitors from one web address to another. Common uses:

  • 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 a parked domain to your main website

Redirect Types

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

302 — Temporary redirect
Use this only if you intend to restore the original URL later.


Method 1: Redirect via DirectAdmin

Step 1 — Log into DirectAdmin.

Step 2 — Under Domain Settings, click Domain Redirects.

Step 3 — Click Add Redirect.

Step 4 — Enter the source URL and the destination URL.

Step 5 — Select 301 Permanent or 302 Temporary.

Step 6 — Click Save.


Method 2: Redirect via .htaccess

For more control, add redirect rules to your .htaccess file. Access it via DirectAdmin 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

Important Notes

  • Always back up your .htaccess file before editing — a mistake can take your website offline
  • Clear your browser cache after setting up a redirect before testing
  • If you see "Too many redirects", you have a redirect loop — check your rules carefully

Need Help?

Our support team is available every day from 7am to 10pm via live chat at hostking.host or by opening a ticket at my.hostking.host.

Kas see vastus oli kasulik? 0 Kasutajad peavad seda kasulikuks (0 Hääled)