Creating URL Redirects in DirectAdmin

A URL redirect allows users visiting a URL to be taken to a different URL address instead. This can be helpful for pages that are relocated, nonexistent, or external to your site.

Basic URL Redirects

If the URL that you want to redirect consists of your domain name and a path, such as

‘http://www.domain.com/path/to/page/’

You can set up this redirect through your DirectAdmin panel.

Creating a Redirect
  1. Log in to DirectAdmin.
  2. Navigate to the appropriate user account, then select the domain from the drop-down at the top of the page.
  3. Under the Account Management menu select Site Redirection.
  4. Click “Create New Redirect”.
  5. Enter the path for the URL you want to redirect from. Leave the path blank to redirect your root domain.
  6. Leave the redirect type as “301 – Permanent”.
  7. Enter the destination URL you want to redirect to. This must be a full URL such as ‘http://www.redirect.com’;.
  8. Click “Create”.

This will automatically add the redirect in your domain’s .htaccess file.

Deleting a Redirect
  1. Check the box in the leftmost column for the redirect you wish to remove.
  2. Click “Delete”, and then click again to confirm.
Subdomain Redirects

If the URL you want to redirect contains a subdomain, such as

‘http://shop.domain.com/path/’

You will first need to add the subdomain, and then set the redirect with a line of code in the .htaccess file.

  1. If the subdomain does not yet exist, see our guide on creating subdomains.
  2. Open the file system using DirectAdmin’s File Manager or through FTP or SSH.
  3. Navigate to the subdomain directory. For example, the ‘shop’ subdomain would have the directory ‘…/domain.com/public_html/shop’;.
  4. Open the .htaccess file in this directory for editing. If there is no .htaccess in this directory, create one.
Redirecting an Entire Subdomain to URL

Add this line of code to redirect http://shop.yourdomain.com to http://www.redirection.com. Make the appropriate changes to this code to match your desired redirection URL.

Redirect 301 / http://www.redirection.com

Redirecting a Specific Page or Path

Add this line of code to redirect http://shop.yourdomain.com/path/to/page to http://www.redirection.com. Make the appropriate changes to this line to match your desired page path and redirection URL.

Redirect 301 /path/to/page http://www.redirection.com

WordPress Redirects

If your site uses WordPress, then we recommend using a plugin to manage your redirects. This is because editing the .htaccess can create issues for a WordPress site.

Some popular plugins that handle redirects are:

  • Redirection
  • SEO Redirection Plugin