Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
However, it does not work as expected with DirectAdmin. While trying to find a solution, I've read that you have a 'special' way of handling subdomains, which probably causes this problem.
I cannot add more domains to my hosting package, so the alternative way of adding subdomains is not possible.
http://domain.tld/ stays http://domain.tld/
http://www.domain.tld/ goes to http://domain.tld/
http://sub.domain.tld/ stays http://sub.domain.tld/
WRONG:
http://www.sub.domain.tld/ goes to http://sub.domain.tld/sub/
THIS SHOULD HAPPEN:
http://www.sub.domain.tld/ goes http://sub.domain.tld/
Any help will be appreciated!