Introduction
Some users want traffic to their dedicated IP address redirected to the primary domain on their account. This requires a custom Apache included.
Procedure
- Log into WHM as the 'root' user.
- Navigate to "Home / Service Configuration / Apache Configuration / Include Editor."
- Select "All versions" from the "I wish to edit the Pre VirtualHost configuration include file for" dropdown menu.
- Add a VirtualHost entry similar to the following in the text box.
<VirtualHost 203.0.113.2:80>
Please note that the IP address, domain name, admin email address, and document root must be replaced with the appropriate values for the domain to be redirected to.
ServerName domain.tld
ServerAdmin webmaster@domain.tld
DocumentRoot /home/username/public_html
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^203\.0\.113\.2$
RewriteRule ^/(.*)$ http://domain.tld/$1 [L,R=301]
</IfModule>
</VirtualHost> - Click the "Update" button.
- Click the "Restart Apache" button.
Additional resources
Comments
0 comments
Article is closed for comments.