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
- Log in to DirectAdmin.
- Navigate to the appropriate user account, then select the domain from the drop-down at the top of the page.
- Under the Account Management menu select Site Redirection.
- Click “Create New Redirect”.
- Enter the path for the URL you want to redirect from. Leave the path blank to redirect your root domain.
- Leave the redirect type as “301 – Permanent”.
- Enter the destination URL you want to redirect to. This must be a full URL such as ‘http://www.redirect.com’;.
- Click “Create”.
This will automatically add the redirect in your domain’s .htaccess file.
Deleting a Redirect
- Check the box in the leftmost column for the redirect you wish to remove.
- 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.
- If the subdomain does not yet exist, see our guide on creating subdomains.
- Open the file system using DirectAdmin’s File Manager or through FTP or SSH.
- Navigate to the subdomain directory. For example, the ‘shop’ subdomain would have the directory ‘…/domain.com/public_html/shop’;.
- 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