301 directory to subdomain but maindomain still usable?

Discussion in 'Apache' started by Kellerkind, Oct 10, 2006.

  1. #1
    This one might be a bit tricky and I'm not sure if this could work...

    http://www.rabbit.com/cat/mouse/title ->
    http://archives.rabbit.com/cat/mouse/title

    I have an old wordpress blog but I upgrade to a new script and everything that is in http://www.rabbit.com/cat/ should be redirected. Nothing else because I will keep on using the domain.

    Here would be my approach would be great if someone could help me out:

    1. My idea was to make a directory www.rabbit.com/cat/ and put the .htaccess in there.

    2. I'm not sure about this here but every time someone follows a link to this /cat/ folder they should be redirected to the same folder just on the archives subdomain.

    I tried a lot to mess around with mod_rewrite but I don't get it right. Any help would be great.
     
    Kellerkind, Oct 10, 2006 IP
  2. Kellerkind

    Kellerkind Active Member

    Messages:
    160
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #2
    Can anyone please tell me if this is possible at all and I will continue trying to sort it out...
     
    Kellerkind, Oct 14, 2006 IP
  3. Jean-Luc

    Jean-Luc Peon

    Messages:
    601
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hi,

    I would try this :
    Options +FollowSymlinks
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^www.rabbit.com$
    RewriteRule ^cat\/(.*) http://archives.rabbit.com/cat/$1  [QSA,L,R=301]
    Code (markup):
    Jean-Luc
     
    Jean-Luc, Oct 14, 2006 IP
  4. Kellerkind

    Kellerkind Active Member

    Messages:
    160
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #4
    You're the man Jean-Luc!
    Thanks a lot!
     
    Kellerkind, Oct 14, 2006 IP