Was this article helpful?

Redirect your site or a page to another address

Domains, subdomains and DNS2 min read

A redirect automatically sends anyone who visits one address to another. It is useful, for example, when you renamed a page, when you moved your site to a new domain or when you want yourdomain.com/promo to lead to an external page. In DirectAdmin they are created in Site Redirection, without touching code.

301 or 302: which one to use

TypeMeaningWhen to use it
301PermanentThe page has moved for good. Search engines pass the old address's ranking to the new one.
302TemporaryA short-term change, such as a promotion or maintenance. Search engines keep the original address.

If in doubt and the change is permanent, use 301. Keep in mind that browsers remember 301 redirects: if you make a mistake, you may need to clear the browser cache to see the fix.

Create a redirect

  1. Log in to DirectAdmin from Shortcuts in the Client Area.
  2. Choose the domain in the selector at the top and open Site Redirection. You can search for "redirect".
  3. Click the button to create a redirect.
  4. In the source, type the local path you want to redirect, starting with a slash: for example /promo or /old-page.html.
  5. Choose the type: 301 or 302.
  6. In the destination, type the full address, with https://: for example https://yourdomain.com/new-page.
  7. Save and test the source address in a private browser window.

To remove a redirect, select it in the same list and delete it.

Common cases

  • Forcing https: you do not need a manual redirect. In SSL Certificates, turn on Force SSL with https redirect once your certificate has been issued.
  • Making another domain lead to your site: use Domain Pointers, explained in another article in this section.
  • Moving the whole site to a new domain: create a 301 redirect from the root (/) to the new domain. If the pages keep the same paths, a rule in .htaccess can preserve them.

Redirects with .htaccess

Your hosting's web server is LiteSpeed and it honors the .htaccess file for common rewrite rules. If you need more advanced rules, you can write them in the .htaccess file in your domain's public_html folder. For example, a permanent redirect for one page:

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

Make a copy of the file before editing it: a mistake in .htaccess can make the site show an error. If you use WordPress, do not delete the rules WordPress writes in that file.

If something does not work

  • The redirect does not apply: check that the source path starts with / and that the correct domain is chosen in the selector.
  • The browser says there are too many redirects: there is a loop, for example a page redirecting to itself or rules that conflict with your application's. Delete the last redirect you created.
  • You still see the old redirect: clear the browser cache or try a private window.

If you need help, open a ticket at https://linkeia.com/submitticket.php with Technical Support, including the source and destination addresses.

Was this article helpful?

Share

Related articles

Didn't find what you were looking for?

Our team will help you sort it out.