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.

Non-WWW 301 Redirect Problem

Discussion in 'Apache' started by raoraj, Feb 23, 2012.

  1. #1
    Hi,
    What i want to do is

    Step1. CNAME Record: points www.subdomain.mydomain.com to www.affiliate.com

    Step2. 301 redirect: points subdomain.mydomain.com to www.subdomain.mydomain.com

    now i have added CNAME Record and Step1 is working. when i open www.subdomain.mydomain.com it opens www.affiliate.com
    thats fine.

    Problem with Step2.

    to complete Step2 i have made .htaccess file with these rules

    RewriteEngine On
     RewriteCond %{HTTP_HOST} ^subdomain.mydomain.com
     RewriteRule (.*) http://www.subdomain.mydomain.com/$1 [R=301,L]
    Code (markup):
    now the problem is that
    when i open subdomain.mydomain.com it opens mydomain.com

    now i don't know what to do?
     
    raoraj, Feb 23, 2012 IP
  2. JohnnyMazuma

    JohnnyMazuma Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Change to the following:RewriteEngine On RewriteCond %{HTTP_HOST} ^subdomain.mydomain.com RewriteRule (.*) http://www.mydomain.com/$1 [R=301,L] Johnny Mazuma
     
    JohnnyMazuma, Feb 23, 2012 IP