How To Server

[Beginners] HOW TO ADD REDIRECTION OF DOMAIN IN VESTA CP

techrado

Tips on how to create area / net redirection utilizing VestaCP. The answer is mainly easy which I feel if you’re acquainted sufficient with LAMP (or say Apache), however it’s fairly complicated for some newbies. So right here it’s a brief / fast Vesta Management Panel tutorial devoted for beginner.

WHM/cPanel that gives sure menu to create Area Redirection so a consumer will perceive what’s it and learn how to use it, VestaCP doesn’t have that characteristic so customers should make use of and create Apache .htaccess Redirection manually.

THIS IS IN WHM/CPANEL

2015-07-27_201934

AND DO THIS IN VESTACP

Step 1 – Install VestaCP on your server.

Step 2 – Now login to VestaCP dashboard and add new website. Click on WEB menu then click Add Web Domain.

2015-07-27_202809

Step 3 – Type in the domain name you want to forward / redirect then click the green Add button.

2015-07-27_203001

once done you’ll see this message:

2015-07-27_203150

Step 4 – Now launch Terminal up and login to your server via SSH as root or as user with sudo privilege (or as admin if you configured admin to have SSH access)

2015-07-27_203551

Step 5 – Now go to web directory of your newly added website/domain which it should be at this location:

1cd /home/user/web/domain.tld/public_html

In my situation it is:

1cd /home/admin/web/techrado.com/public_html

replace user and domain.tld with your own.

Step 6 – Create new .htaccess file (or edit it if it’s created already):

1nano .htaccess

Step 7 – Now put these lines in there:

1234RewriteEngine onRewriteCond %{HTTP_HOST} ^example.com [NC,OR]RewriteCond %{HTTP_HOST} ^www.example.com [NC]RewriteRule ^(.*)$ http://example.org/$1 [L,R=301,NC]

the htaccess redirection above does 301 redirect from example and www.example.com to http://example.org and so that old links to example.com carry over. Just replace example.com and example.net above with your own.

Now save changes and exit the editor. In Nano it is Control+O then Control+X.

That’s it. Now everytime anyone opens example.com or www.example.com will be forwarded to example.com. And so if anyone opens example.com/any-link or www.example.com/any-link will be redirected to example.org/any-link. Cool huh?

Cheers!


About the author

Muhammad Zain Zaheer

An Accidental Writer, Tech Geek and Founder of Apoic Technologies. Contributor @TechRado_com

Add Comment

Click here to post a comment