I 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 Include Pre Virtual Host Include Post Virtual Host Include <VirtualHost *:80> ServerName example.com ServerAlias www.example.com ***********Redirect 301 / https://example.com/ (Cpanel Remove this) ... </VirtualHost> Code (markup): Is there any way i can redirect my domain with virtualhost or at domain registrar or VPS level? I have Managed VPS with root access but i don't have good server knowledge.
cPanel will remove this each time apache is rebuild. You should have line in httpd.conf like : # To customize this VirtualHost use an include file at the following location Use that to put your redirect in, or you can put your redirect in like above and then run: /usr/local/cpanel/bin/apache_conf_distiller --update John