Redirect 301 on a WHM Litespeed server and Easy Apache Configuration

Litespeed Guide:

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]

Apache Guide

cat /etc/apache2/sites-available/webmail-redirect.conf

<IfModule mod_ssl.c>
<VirtualHost *:443>
    ServerName webmail.example.com
    Redirect 301 / https://mail.example.com/webapp
</VirtualHost>
</ifModule>
<VirtualHost *:80>
    ServerName webmail.example.com
    Redirect 301 / https://mail.example.com/webapp
</VirtualHost>

References

Share this article

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top