With reference of answer by @TomBrossman hereI need to redirect all domain versions to my default domain i.e. https://example.com/. By all domain versions I mean http://www, http:// and https://www. I don't want htaccess redirect.When I add Redirect line in httpd.conf. cPanel removes it. After some research I came to know that I've 3 options to change in cPanel environment. Pre Main IncludePre Virtual Host IncludePost Virtual Host Include<VirtualHost *:80>ServerName example.comServerAlias www.example.com**Redirect 301 / https://example.com/ (Cpanel Remove this)** ... </VirtualHost>Is there anyway I can redirect my domain with VirtualHost on cPanel? Or even by domain registrar or DNS setting?I have a VPS with root access.
Domain redirection with virtualhost on cpanel environment
301 redirect;apache2;virtualhost