GigaGlobe

Forcing HTTPS in DirectAdmin

54 views Security & SSL
<h3>Redirecting All HTTP Traffic to HTTPS</h3> <p>After installing an SSL certificate, you should redirect all HTTP requests to HTTPS to ensure visitors always use the secure version of your site. There are two main ways to accomplish this in DirectAdmin.</p> <h3>Method 1: Using DirectAdmin's Built-in Option</h3> <ol> <li>Log in to DirectAdmin and navigate to <strong>Account Manager &rarr; SSL Certificates</strong>.</li> <li>Check the box labeled <strong>Force SSL with https redirect</strong>.</li> <li>Click <strong>Save</strong>.</li> </ol> <p>This method automatically adds the necessary redirect rules to your Apache or Nginx configuration without requiring manual file edits.</p> <h3>Method 2: Using .htaccess (Apache)</h3> <p>If you need more granular control, add the following rules to the <code>.htaccess</code> file in your domain's <code>public_html</code> directory:</p> <pre><code>RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]</code></pre> <p>This creates a 301 permanent redirect from HTTP to HTTPS for all pages.</p> <h3>Method 3: Nginx Configuration</h3> <p>If your server uses Nginx (or OpenLiteSpeed), the <code>.htaccess</code> method will not work. Instead, DirectAdmin allows custom Nginx configuration. Create or edit the custom Nginx config for your domain:</p> <pre><code>if ($scheme = http) { return 301 https://$host$request_uri; }</code></pre> <div class="alert alert-info">After enabling HTTPS redirection, update your website's internal links and settings (e.g., WordPress Site URL) to use <code>https://</code> to avoid mixed content warnings.</div> <h3>Verifying the Redirect</h3> <ul> <li>Open a browser and visit <code>http://yourdomain.com</code>. You should be automatically redirected to <code>https://yourdomain.com</code>.</li> <li>Use browser developer tools (Network tab) to confirm you receive a <strong>301</strong> status code for the redirect.</li> <li>Check for mixed content warnings by looking at the browser console for any resources still loading over HTTP.</li> </ul>
Need More Help?

Can't find what you're looking for? Our support team is ready to help.

Contact Support
Hi there! How can we help?