What is a website redirect?

A website redirect automatically sends visitors from one URL to another. When someone types the old URL, their browser immediately loads the new URL instead.

Common redirect scenarios

  • Redirect www.yourdomain.co.za to yourdomain.co.za (or vice versa)
  • Redirect old domain to new domain after rebranding
  • Force HTTP to HTTPS for security
  • Redirect deleted pages to new locations
  • Temporary redirects during maintenance or testing

Redirect types: 301 vs 302

Type Meaning SEO Impact Use When
301 Permanent redirect Passes SEO value to new URL Domain changes, permanent moves
302 Temporary redirect Keeps SEO value on original URL Maintenance, A/B testing

Recommendation: Use 301 redirects for all permanent URL changes. Search engines transfer rankings and authority from the old URL to the new URL.

Redirect vs domain pointer

Redirects and domain pointers serve different purposes:

  • Redirect: Changes the URL in the browser (SEO-friendly)
  • Domain Pointer: Keeps the URL as typed (potential duplicate content issues)

See our detailed comparison guide for more information.

Method 1: Creating redirects in DirectAdmin

Step 1: Access redirect management

  1. Log in to DirectAdmin
  2. Go to Domain Setup
  3. Click Site Redirect or Redirects

Step 2: Create a new redirect

  1. Click Create Redirect
  2. Domain: Select the source domain from the dropdown
  3. Redirect from (path): Enter the path to redirect from (leave blank for entire domain)
  4. Redirect to (URL): Enter the full destination URL (e.g., https://newdomain.co.za)
  5. Redirect type: Choose 301 Permanent or 302 Temporary
  6. Match www: Check to redirect both www and non-www versions
  7. Click Create

Example: Redirect entire domain

  • Domain: olddomain.co.za
  • Redirect from: (leave blank)
  • Redirect to: https://newdomain.co.za
  • Type: 301 Permanent

Result: All pages on olddomain.co.za redirect to newdomain.co.za

Example: Redirect specific page

  • Domain: yourdomain.co.za
  • Redirect from: /old-page
  • Redirect to: https://yourdomain.co.za/new-page
  • Type: 301 Permanent

Result: yourdomain.co.za/old-page redirects to yourdomain.co.za/new-page

Method 2: Using .htaccess for redirects

For more control and advanced redirects, edit the .htaccess file directly.

Accessing .htaccess

  1. Go to File Manager in DirectAdmin
  2. Navigate to public_html folder
  3. Find the .htaccess file (show hidden files if not visible)
  4. Right-click and select Edit

If .htaccess does not exist, create a new file named .htaccess in the public_html folder.

Common .htaccess redirect examples

Force www to non-www:

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

Force non-www to www:

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

Force HTTP to HTTPS:

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

Redirect entire domain:

RewriteEngine On
RewriteRule ^(.*)$ https://newdomain.co.za/$1 [R=301,L]

Redirect single page:

Redirect 301 /old-page.html https://yourdomain.co.za/new-page.html

Redirect multiple pages:

Redirect 301 /about.html https://yourdomain.co.za/about-us
Redirect 301 /contact.html https://yourdomain.co.za/contact-us
Redirect 301 /services.html https://yourdomain.co.za/our-services

Common redirect use cases

1. www to non-www (recommended for SEO)

Choose one canonical URL and redirect the other:

  • Option A: Redirect www.yourdomain.co.za β†’ yourdomain.co.za
  • Option B: Redirect yourdomain.co.za β†’ www.yourdomain.co.za

SEO impact: Consolidates all link authority and rankings to one version. Google treats www and non-www as separate sites without a redirect.

2. HTTP to HTTPS (security)

Force all traffic to use SSL encryption:

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

This ensures all visitors use the secure HTTPS protocol, improving SEO and security.

3. Old domain to new domain

After rebranding or domain change:

  1. Add both domains to DirectAdmin (old as addon domain, new as primary or addon)
  2. Create 301 redirect from old domain to new domain
  3. Keep the redirect active for at least 12 months for SEO transition

4. Deleted pages to relevant alternatives

When removing pages, redirect to the most relevant alternative:

Redirect 301 /old-product.html https://yourdomain.co.za/new-product
Redirect 301 /discontinued-service.html https://yourdomain.co.za/services

5. Temporary maintenance redirect

During site maintenance, redirect to a maintenance page (use 302):

Redirect 302 / https://yourdomain.co.za/maintenance.html

Remove the redirect when maintenance is complete.

Managing redirects

Viewing existing redirects

  1. Go to Domain Setup β†’ Site Redirect in DirectAdmin
  2. You will see all active redirects with source, destination, and type

Testing redirects

  1. Open your web browser
  2. Type the old URL
  3. Press Enter and watch the browser redirect to the new URL
  4. Check the URL bar shows the destination URL

Use browser developer tools (F12 β†’ Network tab) to verify the HTTP status code (301 or 302).

Modifying redirects

To change a redirect:

  1. Delete the existing redirect
  2. Create a new redirect with updated settings

Deleting redirects

  1. Go to Site Redirect in DirectAdmin
  2. Find the redirect you want to remove
  3. Click Delete
  4. Confirm deletion

SEO best practices for redirects

  • Always use 301 for permanent changes: Transfers SEO value to the new URL
  • Redirect to relevant content: Don't redirect all old pages to the homepage
  • Keep redirects active long-term: Maintain 301 redirects for at least 12 months
  • Update internal links: Edit your website to link directly to new URLs (don't rely on redirects)
  • Avoid redirect chains: Don't redirect A β†’ B β†’ C. Redirect A β†’ C directly
  • Monitor crawl errors: Use Google Search Console to identify broken links
  • Canonical URL consistency: Redirect all variations to one canonical URL

Troubleshooting redirects

Redirect not working

If the redirect does not activate:

  • Clear your browser cache (Ctrl+Shift+Delete or Cmd+Shift+Delete)
  • Test in an incognito/private browsing window
  • Verify the redirect was created correctly in DirectAdmin
  • Check .htaccess syntax if using manual redirects
  • Ensure the destination URL is correct and accessible

Redirect loop error

"Too many redirects" or redirect loop errors occur when:

  • A redirects to B, and B redirects back to A
  • Conflicting redirect rules in .htaccess
  • WordPress or CMS redirect settings conflict with server redirects

Fix: Review all redirect rules and remove circular redirects. Check WordPress Settings β†’ General for URL mismatches.

Redirect changes URL but not content

If the URL changes but the page content is wrong:

  • Verify the destination URL points to the correct page
  • Check the destination domain is correctly configured
  • Ensure the destination page has content (not blank or error)

.htaccess redirect causes 500 error

If the website shows "Internal Server Error" after adding redirects:

  • Check .htaccess syntax carefully (one mistake breaks the entire file)
  • Remove the redirect rules temporarily to restore the site
  • Add rules one at a time to identify the problematic line
  • Contact support for .htaccess troubleshooting

Advanced redirect scenarios

Redirect with query string preservation

Preserve URL parameters when redirecting:

RewriteEngine On
RewriteRule ^old-page\.html$ /new-page.html [R=301,L,QSA]

The [QSA] flag preserves query strings like ?id=123&page=2.

Redirect based on country

Redirect visitors based on their location (requires GeoIP):

RewriteEngine On
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^ZA$
RewriteRule ^(.*)$ https://za.yourdomain.com/$1 [R=302,L]

Contact 0724 Hosting support to enable GeoIP if needed.

Redirect mobile users

Redirect mobile devices to a mobile-optimised site:

RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} "android|iphone|mobile" [NC]
RewriteRule ^(.*)$ https://m.yourdomain.co.za/$1 [R=302,L]

Note: Responsive design is preferred over separate mobile sites for modern websites.

When to avoid redirects

  • Temporary testing: Use subdomains or staging environments instead of redirecting the live site
  • Frequent URL changes: Plan URL structure carefully to avoid repeated redirects
  • Performance-critical pages: Direct links are faster than redirects
  • Internal navigation: Update internal links instead of relying on redirects

Redirect vs canonical tag

Both redirects and canonical tags address duplicate content, but they work differently:

  • Redirect: Forces browsers to load a different URL (user sees the new URL)
  • Canonical tag: Tells search engines which version to index (user sees the current URL)

When to use each:

  • Redirects: URL changes, domain migrations, consolidating variations
  • Canonical tags: Duplicate content, URL parameters, printer-friendly versions

Getting help with redirects

If you need assistance creating redirects, troubleshooting redirect loops, migrating domains, or planning redirect strategy for SEO, contact 0724 Hosting support. We can help with complex redirect configurations, .htaccess rules, and SEO-friendly redirects.