Redirect 301 on a WHM Litespeed server

When we tried to set up redirection on what is a default WHM Litespeed installation, we had a ton of trouble. In theory Litespeed uses Apache .htaccess format, so we set up looking for information on both Apache and Litespeed.

None of the “common” redirect rules worked, and then after much Googling it started feeling like actually there is no “default” redirect rules. Of the three sets below, only the top one worked reliable.

Go figure, redirecting turns out to be super complicated.

# Enable redirect engine
RewriteEngine On

# Top set
Redirect 301 /knowledgebase/ https://kb.vander.host/
Redirect 301 /knowledgebase-tag/ https://kb.vander.host/tags/
Redirect 301 /knowledgebase-category/ https://kb.vander.host/

# Middle set
RedirectMatch 301 ^/knowledgebase/(.*)$ https://kb.vander.host/$1 [L,R=301]
RedirectMatch 301 ^/knowledgebase-tag/(.*)$ https://kb.vander.host/tags/$1 [L,R=301]
RedirectMatch 301 ^/knowledgebase-category/(.*)$ https://kb.vander.host/$1 [L,R=301]

# Bottom set
RewriteRule ^/knowledgebase/(.*)$ https://kb.vander.host/$1 [L,R=301]
RewriteRule ^/knowledgebase-tag/(.*)$ https://kb.vander.host/tags/$1 [L,R=301]
RewriteRule ^/knowledgebase-category/(.*)$ https://kb.vander.host/$1 [L,R=301]

References

Share this article

Leave a Reply

Your email address will not be published.

Scroll to Top