Mod Rewrite Help - Direct all but single folder

Discussion in 'Apache' started by dillony, Dec 18, 2006.

  1. #1
    I need to be able to direct all traffic from domain2.com to domain1.com, except one single folder. Is this possible?

    For example:
    www.domain2.com -> www.domin1.com
    www.domain2.com/keep -> www.domain2.com/keep

    Thanks in advance.
     
    dillony, Dec 18, 2006 IP
  2. dillony

    dillony Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Also:
    www.domain2.com/test.html -> www.domain1.com/test.html

    www.domain2.com/* -> www.domain1.com/*
    (any other file/folder other than the "keep" folder)

    Thanks.
     
    dillony, Dec 18, 2006 IP
  3. dillony

    dillony Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I've got it working, but not the way I want it to:

    domain2.com/.htaccess
    Options +Indexes
    Options +FollowSymlinks
    RewriteEngine on
    RewriteBase /
    
    RewriteRule ^(.*)$ http://www.domain1.com/$1 [R=301,L]
    Code (markup):
    domain2.com/keep/.htaccess
    RewriteEngine off
    Code (markup):
    I would rather use only one .htaccess file in the root directory if possible.

    Also, would like for the url shown when you go to www.domain2.com/test.html to show "www.domain2.com/test.html" instead of "www.domain1.com/test.html".

    Thanks.
     
    dillony, Dec 18, 2006 IP
  4. dillony

    dillony Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Finally got it figured out on my own.

    domain2.com/.htaccess
    RewriteEngine  on
    RewriteBase    /
    RewriteRule    ^(.*)$  http://www.domain1.com/$1  [P]
    Code (markup):
     
    dillony, Dec 18, 2006 IP