Choose a redirect type and the tool writes the rewrite rules for Apache and LiteSpeed (.htaccess on cPanel, DirectAdmin and most shared hosting) plus the equivalent nginx configuration. The rules avoid redirect loops behind Cloudflare and load balancers by also checking X-Forwarded-Proto.
Table of Contents
Where to put the rules
Add the rules at the very top of the .htaccess file in the site’s document root, above the # BEGIN WordPress block, so they run before any application rewrite. LiteSpeed reads .htaccess the same way Apache does; after editing, LiteSpeed Enterprise picks up the change automatically.
Always test with curl -I http://example.com/ and curl -I https://www.example.com/ and confirm you get a single 301 to the final URL, not a chain of several redirects.
Avoiding redirect loops
If the site sits behind Cloudflare with SSL mode Flexible, the origin always sees HTTP and a plain HTTPS redirect loops forever. Set Cloudflare to Full (strict) with a valid origin certificate, or keep the X-Forwarded-Proto condition the generator adds.
Htaccess redirect generator at a glance



Official documentation: DirectAdmin documentation, cPanel & WHM documentation, Linux man pages.
Related guides: Fixing /scripts/upcp failures, tier blockers and “Upgrade blocked” on an unsupported OS · DirectAdmin removed legacy API endpoints in 2025–2026: what they were and their /api/ replacements · Broken custom Apache/nginx templates after the DOCROOT token change in DirectAdmin 1.710.
Frequently asked questions
301 or 302?
Use 301 for permanent moves so search engines transfer rankings. Use 302 only for temporary redirects such as maintenance pages.
Does cPanel’s Redirects page do the same thing?
Yes; cPanel writes similar rules into .htaccess. Writing them yourself gives you control over order and conditions.
How long should I keep a domain redirect?
At least a year, and ideally for as long as the old domain has links pointing to it.