• 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 configure Apache URL Redirection on Rocky Linux 8.6

  • 00:34 cat /etc/os-release
  • 00:43 yum install httpd* -y
  • 01:31 systemctl status httpd
  • 01:49 firewall-cmd --add-port=80/tcp --permenent
  • 02:33 setenforce 0
  • 02:54 vim index.html
  • 03:10 chown -R apache:apache index.html
  • 03:27 chmod -R 775 index.html
  • 03:48 vim /etc/httpd/conf.d/test.conf
  • 05:29 systemctl restart httpd
{{postValue.id}}

To Configure Apache URL Redirection On Rocky Linux 8.6

Introduction

Apache HTTP Server is a free and open-source web server that provides web content through the internet. It is referred to as Apache and after development, it fastly became the most popular HTTP client on the web.

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

[root@linuxhelp~]# cat /etc/os-release 
NAME="Rocky Linux"
VERSION="8.6 (Green Obsidian)"
ID="rocky"
ID_LIKE="rhel centos fedora"
VERSION_ID="8.6"
PLATFORM_ID="platform:el8"

Step 2: Install the Apache Web server package by using the below command

[root@linuxhelp ~]# yum install httpd* -y
Last metadata expiration check: 0:32:52 ago on Tue 28 Jun 2022 06:19:49 AM EDT.
Dependencies resolved.
=======================================================================================================
 Package                Arch        Version                                       Repository      Size
=======================================================================================================
Installing:
 httpd                  x86_64      2.4.37-47.module+el8.6.0+985+b8ff6398.2       appstream      1.4 M
 httpd-devel            x86_64      2.4.37-47.module+el8.6.0+985+b8ff6398.2       appstream      223 k
 httpd-filesystem       noarch      2.4.37-47.module+el8.6.0+985+b8ff6398.2       appstream       40 k
 httpd-manual           noarch      2.4.37-47.module+el8.6.0+985+b8ff6398.2       appstream      2.4 M
 httpd-tools            x86_64      2.4.37-47.module+el8.6.0+985+b8ff6398.2       appstream      107 k

Step 3: Enable and Start the Apache service by using the below command

[root@linuxhelp ~]# systemctl enable httpd
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.

[root@linuxhlep ~]# systemctl start httpd.service 

Step 4: Check the status of Apache web server by using the below command

[root@linuxhelp ]# systemctl status httpd
httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2022-06-28 06:53:19 EDT; 14s ago
     Docs: man:httpd.service(8)

Step 5: Add firewall for port 80 tcp/udp by using the below command

[root@linuxhelp ]# firewall-cmd --add-port=80/tcp --permanent 
[root@linuxhelp ]# firewall-cmd --add-port=80/udp –-permanent

Step 6: Reload the firewall by using the below command

[root@linuxhelp ]# firewall-cmd --reload

Step 7: Disable SELinux by using the below command

[root@linuxhelp linuxhelp]# setenforce 0

Step 8: Create html file in Apache document root directory in .html format by using the below command

[root@linuxhelp linuxhelp]# cd /var/www/html/

[root@linuxhelp html]# vim index.html
<!DOCTYPE html>
<html>
<body>
<h1 style="font-size:300%;">Welcome to Configure Apache URL Redirection </h1>
<p style="font-size:160%;"> This is Mohamed Musthakeem.A</p>

</body>
</html>

Step 9: Change ownership and give Execute permission for this directory by using the below command

[root@linuxhelp html]# chown -R apache:apache /var/www/html/
[root@linuxhelp html]# chmod -R 775 /var/www/html/

Step 10: Go to the configuration file location and create test.conf file by using the below command.

[root@linuxhelp html]# vim /etc/httpd/conf.d/test.conf
<virtualhost *:80>
servername test.com
Documentroot /var/www/html/
</virtualhost>

Step 11: Restart the Apache service for changes by using the below command

[root@linuxhlep conf.d]# systemctl restart httpd

Step 12: Put the host entry by using the below command

[root@linuxhlep conf.d]#  vim /etc/hosts

Step 13: Restart the apache service for changes

[root@linuxhlep conf.d]# systemctl restart httpd

Step 14: After restarting the service Open your web browser and search test.com as shown in the below image snap 1

Step 15: Now go to the virtual host configuration file to make changes and Configure Apache URL redirection by using the below command

[root@linuxhlep conf.d]# vim /etc/httpd/conf.d/test.conf
<virtualhost *:80>
servername test.com
Documentroot /var/www/html/
Redirect / "https://www.test1.com/"
</virtualhost>

Step 16: Edit the host entry and Restart the Apache service by using the below command

[root@linuxhlep conf.d]# systemctl restart httpd

Step 17: Open the web browser and search test1.com 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 Configure Apache URL Redirection on Rocky Linux 8.6. Your feedback is much welcome.

Tags:
connor
Author: 

Comments ( 0 )

No comments available

Add a comment
{{postCtrl.cmtErrMsg}}

Frequently asked questions ( 5 )

Q

What do you mean by Apache Web Server?

A

Apache web server is the HTTP web server that is open source, and it is used for hosting the website.

Q

How to check the Apache version?

A

You can use the command httpd -v

Q

What is the port of HTTP and HTTPS of Apache?

A

The port of HTTP is 80, and HTTPS is 443 in Apache.

Q

How will you install the Apache server on Linux Machine?

A

This is the common Apache Interview Question asked in an interview. We can give the following command for Centos: yum install httpd . For Debian: apt-get install apache2.

Q

Where are the configuration directories of the Apache webserver in rocky Linux?

A

The configuration file location in rocky linux is /etc/httpd

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 keel johnston ?
Unhide the folders on windows Explorer

Give any solutions to unhide folder using command prompt?

forum3

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.