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 >

2 thoughts on “Apache Website or URL Redirection using httpd.cong

Leave a Reply

Your email address will not be published. Required fields are marked *

Comment moderation is enabled. Your comment may take some time to appear.