CP allow both version of domain to be hosted


Today I observed, CP allowing to host the same name domain with www too without any issue.

Ideally, CP trims ( remove www. ) the domain name and put the only domain name. It should not allow and give Error if someone tyring to host it wrongly.

@usmannasir @CyberPanel

What is wrong with this?
example.com and www.example.com are considered the same domain. Unlike how a subdomain with anything other than www. would be if created like test.example.com

When vhost is generated it always by default adds www. support. cPanel and pretty much every other panel is going to work this way and this is normal.

This is why it even states this when creating the domain.

If you do not want the site to work with www you need to use redirects/rewrites for OLS or LS/Apache style in the .htaccess to ensure it rewrites these to your desired non www. version of the domain. This is not a Cyberpanel issue this is a configuration/setting thing which can be easily addresses via the below methods.

For Openlitespeed see

If your using the free starter Ent Litespeed or paid Litespeed you can use the normal Apache rewrites in the document root.

I don’t normally use OLS but testing this dynamic rule in the rewrites for the domain with my test domain with OLS works nicely

Version: LiteSpeed/1.5.7 Open

RewriteCond %{HTTP_HOST} ^www\.(.)$
RewriteRule (.
) https://%1/$1 [R=301,L]

curl -Iv http://www.example.com

Host: www.example.com
User-Agent: curl/7.58.0
Accept: /

< HTTP/1.1 301 Moved Permanently
HTTP/1.1 301 Moved Permanently
< Date: Sun, 10 Nov 2019 13:42:07 GMT
Date: Sun, 10 Nov 2019 13:42:07 GMT
< Server: LiteSpeed
Server: LiteSpeed
< Location: https://example.com/
Location: https://example.com/
< Connection: Keep-Alive
Connection: Keep-Alive



You are correct and I am not pointing this view.

Let’s assume - Company who doing web design using CyberPanel to host websites.

User A at 6 PM creates a hosting account for project abc.com and uploaded the website. User B from the same team also created an account for the project but will www.abc.com the next day morning at 10 AM. User B not aware of other team member’s actions.

Normally CP or any other panel should show an error that domain already exists. But for above CP not showing any error.

I am considering like www.abc.com and abc.com ( both same ) or www.test.abc.com and test.abc.com ( both same like this ).

Sometimes humans do mistakes and the system should have intelligent to handle if any.

@usmannasir @CyberPanel

It may be a small exception handling function. Not aware if easy or time-consuming.

We can point issues to make CP a more robust and almost zero issues.

Thanks for the clarification and update. I apologize for the misunderstanding.

I was also able to reproduce and confirm this bug as screenshotted below.

I’ll ping him directly about it so we can work on getting the input validated for this.

Thanks for bringing this to our attention.

Thank you !!