301 Redirect for subdomains (htaccess)

Discussion in 'Site & Server Administration' started by mads, Dec 8, 2008.

  1. #1
    Hi,

    I have made a 301 redirect using htaccess:
    "Redirect 301 / http://www.newdomain.com/"

    Problem is that it doesn't redirect stuff from subdomains ("example.olddomain.com").

    Anyone know how to redirect subdomains?

    I want to redirect the subdomains to my new domain without subdomains, i.e. example.olddomain.com >> newdomain.com

    Thanks, Mads
     
    mads, Dec 8, 2008 IP
  2. HSH

    HSH Peon

    Messages:
    73
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    why don't you use .htaccess for a 301 redirect?

    look here for the directions.
     
    HSH, Dec 8, 2008 IP
  3. thuankkk

    thuankkk Active Member

    Messages:
    503
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    95
    #3
    .htaccess in root of example.olddomain.com:
    
    RewriteEngine on
    RewriteRule ^(.*)$ http://newdomain.com/$1 [R=301]
    
    Code (markup):
     
    thuankkk, Dec 8, 2008 IP
  4. mads

    mads Well-Known Member

    Messages:
    762
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    108
    #4
    Is
    RewriteEngine on
    RewriteRule ^(.*)$ http://newdomain.com/$1 [R=301]
    
    Code (markup):
    better than my version?
    Redirect 301 / http://www.newdomain.com/
    Code (markup):
     
    mads, Dec 9, 2008 IP