Hello DirectAdmin Community,
I'm having an issue where the DirectAdmin Site Redirection feature is not working as expected for my domain, example.com, but a manual .htaccess rule works fine. I need help understanding why this is happening and how to fix the Site Redirection feature.
Thank you!
I'm having an issue where the DirectAdmin Site Redirection feature is not working as expected for my domain, example.com, but a manual .htaccess rule works fine. I need help understanding why this is happening and how to fix the Site Redirection feature.
My Setup
- Domain: example.com
- Server IP: 192.168.1.3
- DirectAdmin Version: Latest
- Web Server: Apache
- SSL: Let’s Encrypt certificate installed via DirectAdmin, covering example.com
- Website: Used for a small business
Issue
- Problem: example.com works. www.example.com does not work consistently with HTTPS, and https://example.com sometimes fails. I want to redirect all traffic (http://, www, etc.) to https://example.com.
- DirectAdmin Site Redirection: I set up redirects in DirectAdmin under Account Manager > Site Redirection:
- Redirect : http://example.com to https://example.com (301 Permanent)
- These redirects do not work as expected; www URLs still fail or don’t redirect consistently.
- .htaccess Fix: I added the following to .htaccess in public_html, and it works perfectly:
RewriteEngine On<br>RewriteCond %{HTTPS} off [OR]<br>RewriteCond %{HTTP_HOST} ^www\. [NC]<br>RewriteRule ^(.*)$ https://example.com/$1 [L,R=301]<br> - DNS: Confirmed with my domain provider that DNS is correct, pointing to my nameservers, with A records for both example.com and www.example.com set to 192.168.1.3.
Questions
- Why does the DirectAdmin Site Redirection feature fail to redirect www and HTTP traffic to https://example.com, while the .htaccess rule works?
- Is there a specific configuration in DirectAdmin (e.g., Apache virtual host settings, rewrite module, or SSL settings) that I need to check or enable?
- Could this be related to how DirectAdmin handles Let’s Encrypt certificates or Apache configurations?
Additional Notes
- I’ve updated the Let’s Encrypt certificate to include www.example.com.
- Tested in incognito mode to rule out caching issues.
- My hosting provider manages the nameservers.
Thank you!