Rewrite Rule for redirecting

Discussion in 'Programming' started by htphp, Apr 10, 2011.

  1. #1
    How to redirect any variable(string) to another http://domain2.com/ from http://domain1.com/

    First when user enter domain1.com user can view this website domain1.com/ After loading domain1.com/ If user type in address bar "http://popcorn" "http://go"or user should redirect to domain2.com/.

    What I want when user enter domain1.com & after loading, if user type variable(string) inluding "http://" he should redirect to domain2.com

    How to write rewrite rule for the above example.
     
    htphp, Apr 10, 2011 IP
  2. michalka

    michalka Peon

    Messages:
    79
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Use the below code
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^domain1.com$
    RewriteRule ^(.*) http://domain2.com/$1 [L,R=301] 
    
    Code (markup):
     
    michalka, Apr 10, 2011 IP
  3. htphp

    htphp Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    @michalka not this I want please read question again
     
    htphp, Apr 10, 2011 IP