1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

RewriteRule a subdomain to a folder

Discussion in 'Apache' started by mnaghdi, Nov 12, 2009.

  1. #1
    Hi

    I am trying to:

    Send Sub.mydomain.com to mydomain.com/sub

    and also:

    www . Sub.mydomain.com to mydomain.com/sub

    How can I do this?
     
    mnaghdi, Nov 12, 2009 IP
  2. smcblogger

    smcblogger Peon

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    RewriteCond %{HTTP_HOST} ^my-site.com$
    RewriteRule ^/?(.*)$ http://www.my-site.com/$1 [R=301,L]

    www in www.my-site.com is a sub-domain, so replace www with what ever sub-domain you wish and it should work.
     
    smcblogger, Nov 12, 2009 IP
  3. mnaghdi

    mnaghdi Peon

    Messages:
    48
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    This works fine but it changes the url as well. I just want it to redirect and not change the url.
     
    mnaghdi, Nov 12, 2009 IP
  4. smcblogger

    smcblogger Peon

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    smcblogger, Nov 13, 2009 IP
  5. aprilfool

    aprilfool Peon

    Messages:
    156
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I too got the same problem...Are the above methods working
     
    aprilfool, Nov 13, 2009 IP