Apache HTTP Redirect Steps

Apache HTTP Server

This document provides information on how to accomplish apache http redirect URL from one site to another using the .htaccess.
This document assumes that site that we are redirecting to is mysite.com.

1.In httpd.conf

1.a. Add/Uncomment the following lines

    
       LoadModule rewrite_module modules/mod_rewrite.so
       LoadModule proxy_module modules/mod_proxy.so
       LoadModule proxy_connect_module modules/mod_proxy_connect.so
       LoadModule proxy_http_module modules/mod_proxy_http.so


2.Create a file .htaccess using notepad with the following code.

  Options +FollowSymlinks +SymLinksIfOwnerMatch 
       RewriteEngine On
       Header add name "myadmin"
       RewriteCond %{REQUEST_URI} ^(.*)
       RewriteRule (.*) http://mysite.com/$1 [R=301,P,L]

Change mysite.com to your redirecting URL.

copy .htaccess to the document root of Apache.
To redirect from a differnt folder(temp):

1. Create a new directory in Apache Document root location and name it as temp
2. Copy the .htaccess file to the /temp folder
3. Open the file .htaccess in //temp using notepad and change the code in the file to the following code and save it.

 
 Options +FollowSymlinks +SymLinksIfOwnerMatch 
   RewriteEngine On
   Header add name "myadmin"
   RewriteCond %{REQUEST_URI} ^(/temp.*)
   RewriteRule (.*) http://mysite.com/$1 [R=301,P,L]

 

In case of any ©Copyright or missing credits issue please check CopyRights page for faster resolutions.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.