How to redirect a Website to another URL in Apache Web Server httpd.cong

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

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 192.168.1.1:* >

DocumentRoot /var/www/html/web/
ServerName oldserver.com
RewriteEngine On
RewriteCond %{REQUEST_METHOD} ^TRACE
RewriteRule .* - [F]
< Directory "/var/www/html/web" >
allow from all
Options -Indexes
DirectoryIndex index.html
RedirectPermanent / "http://www.newserver.com/"
< /Directory >
< /VirtualHost >



FOLLOW US :-    
   





2 comments :

  1. Should this be added on the oldserver or the newserver?

    ReplyDelete