How to Set Up Site Redirects in DirectAdmin

Redirects tell your web server to automatically send visitors from one URL to another. They are essential whenever you move pages, rename URLs, launch a new domain, or retire old content. DirectAdmin provides a built-in redirect tool so you can set this up without editing configuration files manually. This guide shows you exactly how.

What Are Site Redirects and Why Use Them?

A site redirect is an instruction that says: "when someone visits URL A, send them to URL B instead." Common use cases include:

301 vs. 302 — Which Redirect Type Should You Use?

301 — Permanent Redirect

A 301 tells browsers and search engines that the move is permanent. The old URL will not come back. Search engines transfer nearly all of the original page's SEO authority (link equity) to the new URL. Use a 301 whenever a page has genuinely moved for good — this is the correct choice for the vast majority of redirects.

302 — Temporary Redirect

A 302 tells browsers and search engines that the move is only temporary and the original URL will eventually return. Search engines keep the original URL in their index and do not transfer SEO authority. Use a 302 only for short-term situations, such as sending visitors to a maintenance page while you update the site, or running a time-limited A/B test.

SEO Tip: Use 301 (Permanent) for any URL that has moved permanently. This ensures search engines update their index and preserves the ranking authority of the original page. Using 302 by mistake on a permanent move will cause you to lose SEO value over time.

How to Create a Redirect in DirectAdmin

  1. Log in to your DirectAdmin control panel.
  2. Navigate to Advanced Features → Site Redirects (the exact label may vary slightly by DirectAdmin version).
  3. Click Add New Redirect.
  4. In the Source URL field, enter the path you want to redirect from. This is the path on your domain (e.g., /old-page or just / for the whole domain).
  5. In the Destination URL field, enter the full destination URL including https:// (e.g., https://www.example.com/new-page).
  6. Select the redirect type: 301 Permanent or 302 Temporary.
  7. Click Save or Add to activate the redirect.

Redirect an Entire Domain

To redirect all traffic from one domain to another (for example after a domain change), set the Source URL to / (the root) and the Destination URL to the new domain with https://. Use 301 Permanent. This sends every visitor who types the old domain to the homepage of the new domain.

Redirect a Specific Path

To redirect only a specific page or subfolder, enter the exact path in the Source field. For example:

Path-specific redirects only affect matching URLs — the rest of your site continues to work normally.

How to Verify That Your Redirect Is Working

After saving a redirect, test it using one of these methods:

  1. Browser test: Visit the source URL in a private/incognito window. The browser should automatically load the destination URL.
  2. Online redirect checker: Use a free tool such as redirect-checker.org or httpstatus.io to confirm the HTTP status code is 301 or 302 as expected.
  3. Developer tools: Open your browser's Network tab (F12), navigate to the source URL, and look for the 301 or 302 response in the request log.
Site Redirects page showing configured redirects
Site Redirects page showing configured redirects
Click Add Redirect (circled) to create a new redirect rule
Click Add Redirect (circled) to create a new redirect rule
Enter source and destination URL then click Add
Enter source and destination URL then click Add

Note: Browser caching can make it look like a redirect is not working if you have visited the URL before. Always test in a private/incognito window or clear your browser cache before concluding there is a problem.

307 and 308 Redirects — When Do They Matter?

Beyond 301 and 302, there are two more redirect status codes that developers working with APIs and form submissions should know about.

307 Temporary Redirect

Like 302, a 307 signals a temporary move. The critical difference is that 307 strictly forbids the browser from changing the HTTP method. If a client sends a POST request to a URL that returns 307, the client must send another POST to the new location — not convert it to a GET. This matters for API endpoints and form handlers where the original request method must be preserved.

308 Permanent Redirect

Like 301, a 308 signals a permanent move and instructs search engines to update their index. It also preserves the HTTP method, making it the equivalent of 301 for non-GET requests in REST APIs. For standard websites that use only GET requests for page navigation, 301 and 302 remain the correct choices. 307 and 308 are for developers building APIs where method integrity across redirects matters.

Wildcard Domain Redirect Using .htaccess

When you change your domain name, you need every single page on the old domain to redirect to the corresponding page on the new domain. Setting up individual redirects for hundreds of pages is impractical. The correct approach is a wildcard redirect that captures the full URL path and appends it to the new domain automatically.

Add the following to the .htaccess file in the root of your old domain:

The $1 placeholder captures everything after the domain root and appends it to the destination, so old-domain.com/services/web-hosting redirects to new-domain.com/services/web-hosting rather than just the homepage. Keep the old domain active and renewed for at least one to two years after the switch to ensure the redirects continue to function and all SEO authority is fully transferred.

Diagnosing and Fixing Redirect Loops

A redirect loop occurs when URL A redirects to URL B and URL B redirects back to URL A — or through a longer chain that eventually cycles back to the starting URL. The browser aborts with an error such as "ERR_TOO_MANY_REDIRECTS" or "This page isn't working — too many redirects." Visitors cannot access the site at all until the loop is resolved.

Trace the Chain with curl

The fastest diagnostic tool is curl -IL from a terminal or command prompt:

Common Causes and Fixes

After any fix, always clear your browser cache and retest using curl -IL or an online redirect checker to confirm the chain terminates cleanly at HTTP 200.

Summary

Full Control of Your Website

AsiaGB hosting includes DirectAdmin with built-in redirect management, SSL, and everything you need to run a professional website.

View Hosting Plans