Help for mod rewrite redirection

Discussion in 'Apache' started by thefreead.net, Mar 7, 2008.

  1. #1
    Hi..
    Well.. i m working over my site but facing few problems with this..
    Please try to sort it out.. thanks...
    I have previosu domain so called domain1.com
    and i got new domain now so called domain2.com
    i want when users come to www.domain1.com/something/123.htm
    then they must get auto redirected to
    www.domain2.com/something/123.htm

    CAN ANY ONE HELP OUT ??
     
    thefreead.net, Mar 7, 2008 IP
  2. proxywhereabouts

    proxywhereabouts Notable Member

    Messages:
    4,027
    Likes Received:
    110
    Best Answers:
    0
    Trophy Points:
    200
    #2
    proxywhereabouts, Mar 7, 2008 IP
  3. thefreead.net

    thefreead.net Peon

    Messages:
    30
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3

    its ok dude...
    but you gave for specific location.. i.e. something/123.htm
    i want for dynamic.. like might be foldername or filename can change
    like somewhere/234.htm

    so i cant make for each and every file.. so suggest something different.
     
    thefreead.net, Mar 8, 2008 IP
  4. Pandemix

    Pandemix Well-Known Member

    Messages:
    954
    Likes Received:
    29
    Best Answers:
    0
    Trophy Points:
    120
    #4
    I'd like to know this too, I tried Google but not much luck there..
     
    Pandemix, Mar 8, 2008 IP
  5. proxywhereabouts

    proxywhereabouts Notable Member

    Messages:
    4,027
    Likes Received:
    110
    Best Answers:
    0
    Trophy Points:
    200
    #5
    Its how I understand your problem.

    You should explain a little bit of details so I can figure out what are you trying to accomplish here.


    So, what I understand now is you want to make a CRR and make every member who came to domain1.com/anything will redirect to domain2.com/anything...is it?

    Assuming the structure of both site are still the same,


    RewriteEngine On
    RewriteCond %{HTTP}
    RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI}

    Does this helps?
     
    proxywhereabouts, Mar 8, 2008 IP
  6. vmihaylov

    vmihaylov Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    In my opinion you need the following

    RewriteRule %{HTTP_HOST} ^domain1.com$ [NC]
    RewriteCond (.*) http://domain2.com/$1 [R=301,QSA,L]
     
    vmihaylov, Mar 12, 2008 IP