Skip to content

Files

Latest commit

0ff2357 · Nov 21, 2022

History

History

Apache Redirects

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

README.md

Apache Redirects

The Nautilus devops team got some requirements related to some Apache config changes. They need to setup some redirects for some URLs. There might be some more changes need to be done. Below you can find more details regarding that:

1. Check if httpd is already installed

rpm -qa | grep httpd

httpd-tools-2.4.6-90.el7.centos.x86_64
httpd-2.4.6-90.el7.centos.x86_64

2. Configure Apache to listen on port 5003

cat /etc/httpd/conf/httpd.conf | grep Listen

-Listen 8080
+Listen 5003

3. Configure Apache to add some redirects

cat /etc/httpd/conf/httpd.conf | grep redirect

# 1) plain text 2) local redirects 3) external redirects

vi /etc/httpd/conf/httpd.conf

Listen 5003

vi /etc/httpd/conf.d/main.conf

<VirtualHost *:5003>
ServerName stapp02.stratos.xfusioncorp.com
Redirect 301 / http://www.stapp02.stratos.xfusioncorp.com:5003/
</VirtualHost>
<VirtualHost *:5003>
ServerName www.stapp02.stratos.xfusioncorp.com:5003/blog/
Redirect 302 /blog/ http://www.stapp02.stratos.xfusioncorp.com:5003/news/
</VirtualHost>

systemctl restart httpd
systemctl status httpd

4. Validate the task

curl http://stapp02.stratos.xfusioncorp.com:5003/

The document has moved <a href="http://www.stapp02.stratos.xfusioncorp.com:5003/">here</a>

curl http://www.stapp02.stratos.xfusioncorp.com:5003

The document has moved <a href="http://www.stapp02.stratos.xfusioncorp.com:5003/news/">here</a>

curl http://www.stapp02.stratos.xfusioncorp.com:5003/news/

404 Not Found

Try to use ServerName directive without http:// scheme.