DirectAdmin

Set up redirects and custom error pages in DirectAdmin

Create 301 and 302 redirects with DirectAdmin Site Redirection, write .htaccess rewrite rules, and add custom 404, 403 and 500 error pages for your domains.

BeginnerDirectAdmin2 min read

Redirects send visitors and search engines from an old address to a new one, protecting your rankings when you restructure a site or change domains. Custom error pages keep visitors on your site when something is missing. DirectAdmin offers simple tools for both, plus full control through .htaccess.

Before you start

  • Your DirectAdmin user login, with the right domain selected at the top.
  • A list of old and new URLs if you are restructuring a site.

Create a redirect with Site Redirection

  1. Go to Account Manager → Site Redirection (in some skins under Advanced Features).
  2. Click Create New Redirect.
  3. Enter the Local URL Path, for example /old-page, or / to redirect the whole site.
  4. Choose the type: 301 – Permanent for moved content (best for SEO) or 302 – Temporary for short-term changes.
  5. Enter the Destination URL, for example https://example.com/new-page.
  6. Click Create.

DirectAdmin writes the rule into the domain's configuration. Delete it from the same page when no longer needed.

Force HTTPS and www

  • HTTPS: in Account Manager → Domain Setup, click the domain and tick Force SSL with https redirect. See Let's Encrypt in DirectAdmin.
  • www or non-www: the same page has Force Redirect options to always use www.example.com or example.com.

Use one method per redirect. Duplicate rules in .htaccess, plugins and DirectAdmin cause redirect loops.

Redirects with .htaccess

For patterns and many URLs, edit public_html/.htaccess with the File Manager. Redirect one page:

Redirect 301 /old-page https://example.com/new-page

Redirect a folder while keeping the rest of the path:

RewriteEngine On
RewriteRule ^shop/(.*)$ https://example.com/store/$1 [R=301,L]

On servers running pure Nginx instead of Apache or LiteSpeed, .htaccess is ignored; use Site Redirection or ask your host.

Custom error pages

DirectAdmin domains include default error files in public_html such as 404.shtml, 403.shtml and 500.shtml. Edit them with the File Manager to match your design, or point Apache to your own pages in .htaccess:

ErrorDocument 404 /errors/not-found.html

A good 404 page explains that the page is missing and links to your home page, search and popular sections. CMS platforms like WordPress generate their own 404 pages through the theme, so you only need this for static sites or folders outside the CMS.

Check your redirects

  • Run curl -I https://example.com/old-page and look for 301 and the Location header.
  • Test in a private window; browsers cache permanent redirects.

Troubleshooting

  • Too many redirects: two rules redirect back and forth, often HTTPS forced twice or a CDN using flexible SSL.
  • 500 error after editing .htaccess: syntax error. Undo the last change and check the domain's error log under System Info & Files → Site Summary / Statistics / Logs.
  • Let's Encrypt renewal fails: exclude /.well-known/acme-challenge/ from whole-site redirects.

Next steps

Was this guide helpful?

Still stuck?

Ask MdmHost AI for a quick answer, or open a ticket and our team will take a look. We are here 24/7.