• Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial News Comments FAQ Related Articles

How to redirect a website using Virtual Host on Debian 11.3

  • 00:30 lsb_release -a
  • 00:45 apt install apache2
  • 00:56 vi /etc/apache2/sites-available/linuxhelp1.com.conf
  • 01:50 mkdir /var/www/html/linuxhelp1
  • 02:10 vi /var/www/html/linuxhelp1/index.html
  • 03:00 chown -R www-data. /var/www/html/linuxhelp1
  • 03:27 vi /etc/hosts
  • 04:10 cd /etc/apache2/sites-available/
  • 04:23 a2ensite linuxhelp1.com.conf
  • 04:37 systemctl reload apache2
  • 05:18 vi linuxhelp1.com.conf
{{postValue.id}}

To Redirect A Website Using Virtual Host On Debian 11.3

Introduction:

In the web server, URL redirect is a technique of pointing one domain or address to another domain or address. It is also an open-source platform that has numerous powerful features and is also regarded as the most prominent web server.

Procedure:

Step 1: Check the OS version by using the below command

[root@linuxhelp ~]# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 11 (bullseye)
Release:        11
Codename:       bullseye

Steps 2: Install Apache web server by using the below command

[root@linuxhelp ~]# apt install apache2
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
apache2 is already the newest version (2.4.53-1~deb11u1).
0 upgraded, 0 newly installed, 0 to remove and 95 not upgraded.

Steps 3: Configure the virtual host for linuxhelp1.com by using the below command

[root@linuxhelp ~]# vi /etc/apache2/sites-available/linuxhelp1.com.conf
<VirtualHost *:80>
ServerName www.linuxhelp1.com
DocumentRoot /var/www/html/linuxhelp1
</VirtualHost>

Steps 4: Make document Root directory as linuxhelp1 by using the below command

[root@linuxhelp ~]# mkdir /var/www/html/linuxhelp1

Steps 5: Make the index.html file for linuxhelp1.com by using the below command

[root@linuxhelp ~]# vi /var/www/html/linuxhelp1/index.html
<!DOCTYPE html>
<html>
<body>
<h1>Welcome To Linuxhelp</h1>
</body>

Steps 6: Give Ownership for DocumentRoot directory by using the below command

[root@linuxhelp ~]# chown -R www-data. /var/www/html/linuxhelp1

Steps 7: Edit Host Entry for linuxhelp1.com by using the below command

[root@linuxhelp ~]# vi /etc/hosts

Steps 8: Change to the sites-available directory by using the below command

[root@linuxhelp ~]# cd /etc/apache2/sites-available/

Steps 9: Enabling the site by using the below command

[root@linuxhelp:cd /etc/apache2/sites-available~#] a2ensite linuxhelp1.com.conf
Enabling site linuxhelp1.com.
To activate the new configuration, you need to run:
  systemctl reload apache2

Steps 10: Reload the service by using the below command

[root@linuxhelp:cd /etc/apache2/sites-available~#] systemctl reload apache2

Steps 11: Now go to browser and browse the domain as shown in the below image snap 1

Steps 12: Next, Reconfigure the virtual host for linuxhelp1.com by using the below command

[root@linuxhelp:cd /etc/apache2/sites-available~#] vi linuxhelp1.com.conf
<VirtualHost *:80>
ServerName www.linuxhelp1.com
Redirect /https://www.gogle.com
DocumentRoot /var/www/html/linuxhelp1
</VirtualHost>

Steps 13: Reload the service by using the below command

[root@linuxhelp /etc/apache2/sites-available~]#  systemctl reload apache2

Steps 14: Finally Go to Browser Refresh the domain in browser as shown in the below image. snap 2

Conclusion:

We have reached the end of this article. In this guide, we have walked you through the steps required to Redirect a website using Virtual Host on Debian 11.3. Your feedback is much welcome.

Tags:
kishore
Author: 

Comments ( 0 )

No comments available

Add a comment
{{postCtrl.cmtErrMsg}}

Frequently asked questions ( 5 )

Q

What is HTTP redirect?

A

The HTTP redirect has a potential method of forwarding visitors and search engines directly from one URL to another.An effective way of solving the issues in URLs and is mainly used while moving content.

Q

What is Hypertext Transfer Protocol?

A

The Hypertext Transfer Protocol occurs in the Internet protocol suite as an application layer. It is mainly used to transmit and fetch resources and is designed in a form to communicate efficiently with web browsers and web servers.

Q

How to Install Apache Webserver?

A

Apt install apache2 command can be used to install the Apache server

Q

Difference between HTTP and HTTPS

A

HTTP is comparatively faster than HTTPS since it consists of the SSL protocol which makes the HTTP page load slower. The HTTP data are not encrypted which makes it appears less secure.

Q

What is an SSL in a web server?

A

It is an acronym for Secure Sockets Layer and it is mainly designed to ensure secure channeling between machines.

Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Isaiah ?
What is the use of SUID & SGID commands

How to set the special permissions to the files and folders using SUID and SGID commands...

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.