How to Configure Apache URL Redirection on Oracle Linux 8.5
- 00:30 cat /etc/os-release
- 00:50 yum install httpd -y
- 01:03 systemctl start httpd
- 01:13 systemctl enable httpd.service
- 01:21 systemctl status httpd
- 01:36 systemctl stop firewalld
- 02:05 cd /var/www/html/
- 02:18 vim index.html
- 02:56 chown -R apache:apache index.html
- 03:10 chmod -R 775 index.html
- 03:27 vim /etc/httpd/conf.d/test.conf
- 04:23 systemctl restart httpd
- 05:03 vim /etc/httpd/conf.d/test.conf
- 05:48 systemctl restart httpd
To Configure Apache URL Redirection on Oracle Linux 8.5
Introduction:
Apache is the worldwide popular web server that is well-supported, feature-rich, and flexible. When designing your web pages, it is helpful for users to view each piece of customized content.
Procedure:
Step 1: Check the OS Version by using the below command
[root@linuxhelp linuxhelp]# cat /etc/os-release
NAME="Oracle Linux Server"
VERSION="8.5"
ID="ol"
Step 2: Install the Apache Web server package by using the below command
[root@linuxhlep ~]# yum install httpd -y
Installed:
apr-1.6.3-12.el8.x86_64
apr-util-1.6.1-6.el8.x86_64
httpd-2.4.37-47.0.1.module+el8.6.0+20683+407db9f5.2.x86_64
httpd-filesystem-2.4.37-47.0.1.module+el8.6.0+20683+407db9f5.2.noarch
httpd-tools-2.4.37-47.0.1.module+el8.6.0+20683+407db9f5.2.x86_64
mod_http2-1.15.7-5.module+el8.6.0+20548+01710940.x86_64
oracle-logos-httpd-84.5-1.0.1.el8.noarch
Complete!
Step 3: Start and enable the Status of apache service by using the below command
[root@linuxhlep ~]# systemctl start httpd
[root@linuxhlep ~]# systemctl enable httpd.service
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.serv
[root@linuxhelp ]# systemctl status httpd
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disable>
Active: active (running) since Tue 2022-06-28 06:07:24 IST; 16s ago
Step 4: Disable and Stop Firewall and SELinux by using the below command
[root@linuxhelp linuxhelp]# systemctl stop firewalld
[root@linuxhelp linuxhelp]# systemctl disable firewalld
Removed /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@linuxhelp linuxhelp]# setenforce 0
Step 5: Create html file for document root in .html format by using the below command
[root@linuxhelp linuxhelp]# cd /var/www/html/
[root@linuxhelp html]# vim index.html
<h1> Welcome
Step 6: Change ownership and give Execute permission for this file by using the below command.
[root@linuxhelp html]# chown -R apache:apache index.htm
[root@linuxhelp html]# chmod -R 775 index.html
Step 7: Go to the configuration location and create test.conf file by using the below command.
[root@linuxhelp html]# vim /etc/httpd/conf.d/test.conf
<virtualhost *:80>
servername linuxhelp1.com
Documentroot /var/www/html/
</virtualhost>
Step 8: Restart the Apache service for changes by using the below command
[root@linuxhlep conf.d]# systemctl restart httpd
Step 9: After restarting the service open your web browser and navigate to the URLs Domain name or IP address. You should see the sample demo page which we created earlier.
Step 10: To Configure Apache URL redirection use the below command and Create the following apache redirect rules on configuration file,
[root@linuxhlep conf.d]# vim /etc/httpd/conf.d/test.conf
<virtualhost *:80>
servername linuxhelp1.com
Documentroot /var/www/html/
Redirect / "https://www.linuxhelp.com/"
</virtualhost>
Step 11: Restart the Apache service by using the below command
[root@linuxhlep conf.d]# systemctl restart httpd
Step 12: After restarting the service, open your web browser and navigate to the URLs Domain name or IP address as shown in the below image.
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 Oracle Linux 8.5. Your feedback is much welcome.
Comments ( 0 )
No comments available