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.

Need .htaccess help domain.com/foldername to foldername.domain.com

Discussion in 'Apache' started by osmasters, Sep 20, 2010.

  1. #1
    Hi,

    I have site called worldsnap.com/news/ which shows all news now i have thought to change it to news.worldsnap.com/.

    Please tell me how can i do this?

    I gave this but its redirecting from worldsnap.com/news/ to news.worldsnap.com/news/

    redirectMatch 301 ^(.*)$ http://news.worldsnap.com$1
    redirectMatch permanent ^(.*)$ http://news.worldsnap.com$1


    Please help me.

    Thanks in Advance.
     
    osmasters, Sep 20, 2010 IP
  2. jocurileus

    jocurileus Peon

    Messages:
    53
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    if you are using the .htaccess from your main domain.
    
    RewriteBase /news
    RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com$
    RewriteRule ^(.*) http://news.domain.com/$1 [R=301,L]
    
    Code (markup):
    or
    
    RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com$
    RewriteRule ^(.*) http://news.domain.com/$1 [R=301,L]
    
    Code (markup):
    if you have an .htaccess in your news folder
    untested use at your own risk.
     
    Last edited: Sep 22, 2010
    jocurileus, Sep 22, 2010 IP
    osmasters likes this.