1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

301 redirect of subdomain.domain

Discussion in 'Search Engine Optimization (SEO)' started by rdubayah, Jun 19, 2007.

  1. rdubayah

    rdubayah New Member

    Joined:
    Jun 19, 2007
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    I currently have a domain that started as one of those free web pages 6 years ago.

    The problem is search engines (one in particular) picked up the original domain subdomain
    and also just the newer domain. www.newdomain.com over the years.
    I have a sitemap that give the correct addresses but it appears a redirect is required?

    Most search engines have corrected automatically but (G) has both, held the original and it won't let it go and splits the two addresses.(Both are listed same content)
    Originally it was www.subdomain.domain.com

    We have a domain that has been registered for several years and the web host advises because the subdomain is now actually the newdomain I need to redirect.

    The Redirect 301 / http://www.newdomain.com/ to redirect the entire site causes a endless loop (both original www.subdomain.domain.com and www.newdomain.com are using the same .htaccess file because they are the same directory.

    I believe I need to redirect only the calls for the original www.subdomain.domain.com
    with a filter but have had no success in attempts to write it.

    thanks for any help in advance
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,293
    Likes Received:
    365
    Trophy Points:
    83
    You need to be putting the following
    Code:
    RewriteEngine On
    RewriteCond %{HTTP_HOST}//s%{HTTPS} ^subdomain\.(.*)//((s)on|s.*)$ [NC]
    RewriteRule ^ http%3://%1%{REQUEST_URI} [L,R=301]
    It will redirect you from the subdomain.newdomain.com to newdomain.com. You could refer to [thread=145]SEO FAQ's[/thread] also
     
  3. rdubayah

    rdubayah New Member

    Joined:
    Jun 19, 2007
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Thanks I will give it a try also. I have been testing and found that the following works also although it took some trial, first I was just getting all the pages redirecting to the home page. I think just not ending the session in the browser was keeping the results from changing.

    Options +FollowSymLinks
    RewriteEngine on
    RewriteCond %{HTTP_HOST} www.origsubdomain.domain.com$ [NC]
    RewriteRule (.*)$ http://www.origsubdomain.com/$1 [R=301,L]
     

Share This Page