Apache Website or URL Redirection using httpd.cong

How to redirect a Website or Domain to another URL or External website or HTTPS in Apache web server httpd.cong

Apache Website Redirection

URL redirection, also called URL forwarding and domain redirection also called domain forwarding

To redirect oldserver.com to newserver.com,
add the following line in your Apache httpd.conf file

RedirectPermanent / “http://www.newserver.com/”

Sample httpd.cong

< VirtualHost* >

DocumentRoot /var/www/html/web/
ServerName oldserver.com
RewriteEngine On
RewriteRule .* – [F]
< Directory “/var/www/html/web” >
allow from all
Options -Indexes
DirectoryIndex index.html
RedirectPermanent / “http://www.newserver.com/”
< /Directory >
< /VirtualHost >