Setup Virtual Host in Open Litespeed Server

From the Listener list select port 80 and click on magnifier icon to enter.
Now, under Virtual Host Mappings add your domain to enable connection.
Virtual Host * | Select from list |
Domains * | example.com |
Enable Virtual Hosts

Virtual Host Name | your_site_name |
Virtual Host Root | $SERVER_ROOT/your_site_name |
Config File | $SERVER_ROOT/conf/vhosts/your_site_name/vhconf.conf |
Follow Symbolic Link | Yes |
Enable Scripts/ExtApps | Yes |
Restrained | Yes |
After enter aboe options correctly click on save button on right top.
Probably you see an error saying no virtual host file and click on click to create option.

Now you have created a basic virtual host file.
Now we have to add additional detail to it to work properly.
View / Edit Virtual Host File
Now view your newly created virtual host file using the magnifier icon.
SELECT > General Tab
Document Root | $VH_ROOT/html |
Domain Name | codemyhalf.com |
Domain Aliases | www.codemyhalf.com |
SELECT > Rewrite Tab
Enable Rewrite | Yes |
Auto Load from .htaccess | Yes |
Do only if you have SSL enabled
Paste below code UNDER Rewrite Rules >
rewriteCond %{HTTPS} !on
rewriteCond %{HTTP:X-Forwarded-Proto} !https
rewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
You have successfully configured virtual host file for your domain for Open LiteSpeed Server.