301 redirect - subdomain to subfolder

by SEODollz 8 replies
Hello Web Design Warriors! Hailing from the SEO forum (please don't lynch me ) to ask for help. Did some searches but couldn't find anything that addressed my current problem.

I have one of those "special" clients that wants to do onsite SEO in house, which is fine by me normally but I can't figure out how to explain how to fix something rather urgent to their designer. My designer is peeved at them and is not being helpful :rolleyes: so I'm trying to make it work.

Anyways, the client's site has 3 big old subdomains that for SEO purposes must be 301 redirected to subfolders/subdirectories. It's Linux w/Apache and their designer has resorted to arguing with GoDaddy support ( :rolleyes: ) to try to get this done. My (rudimentary) understanding is this:

He needs to create an .htcaccess file in the root domain where the subdomains are. This is the generic set of rules I'd like to propose:

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^subdomain\.domain\.com
RewriteRule ^(.*)$ http://domain.com/subfolder/$1 [R=301]

so that would move subdomain A to subfolder A... yes?

For SEO it's got to be a 301 or I lose link juice. So my questions are:

1) Does this code look right?
2) Do I combine the three sets of rules in one .htcaccess or should there be three?

Please feel free to heckle/educate me because I am the first to admit that I'm stuck on this. We do 301 redirects from non www to www versions of sites all the time but this is just beyond me. Thanking you in advance for any advice!
#website design #301 #redirect #subdomain #subfolder
Avatar of Unregistered
  • Profile picture of the author prince55l
    if you are not sure of the code, use a htaccess generator tool. here is link for one
    .Htaccess Redirect Generator
    {{ DiscussionBoard.errors[7986837].message }}
  • Profile picture of the author SEODollz
    Thank you! But I tried the code generators... can't find one for subdomain---> subfolder

    They all seem to be pageA to pageB or domainA to domainB I need to move the subdomain and everything in it to subfolders
    {{ DiscussionBoard.errors[7986921].message }}
  • Profile picture of the author RobinInTexas
    Your code looks good to me, I would test it first and see, you can undo it in a few seconds if it doesn't work.

    You could also test it by creating a dummy sub-domain/subdirectory pair if you don't want to try it on your production site.

    http://dummy.yourdomain.com

    http://yourdomain.com/dummy.
    Signature

    Robin



    ...Even if you're on the right track, you'll get run over if you just set there.
    {{ DiscussionBoard.errors[7987927].message }}
  • Profile picture of the author David V
    This would for example, 301 redirect anyone that went to subdomain.domain.com to domain.com/subdomain
    Simply place this in the .htaccess (or create it) in the root of the subdomain directory.

    Code:
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^subdomain.domain.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www.subdomain.domain.com$
    RewriteRule ^/?$ "http://domain.com/subdomain" [R=301,L]
    Signature
    "David has managed the digital side of my retail business for over 8 yrs
    and I can't imagine working with anyone else. ~ Carrie Silva | TheDoghouseLLC
    "
    {{ DiscussionBoard.errors[7988866].message }}
  • Profile picture of the author Kayster13
    Good insights, thanks for the help.
    {{ DiscussionBoard.errors[7989167].message }}
  • Profile picture of the author Michael71
    David...

    I would also set a NC, just in case

    Code:
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^subdomain.domain.com$ [NC,OR]
    RewriteCond %{HTTP_HOST} ^www.subdomain.domain.com$ [NC]
    RewriteRule ^/?$ "http://domain.com/subdomain" [R=301,L]
    Signature

    HTML/CSS/jQuery/ZURB Foundation/Twitter Bootstrap/Wordpress/Frontend Performance Optimizing
    ---
    Need HTML/CSS help? Skype: microcosmic - Test Your Responsive Design - InternetCookies.eu

    {{ DiscussionBoard.errors[7989221].message }}
  • Profile picture of the author SEODollz
    You guys rock!!! The last one worked like a charm. My hat is off to you gentlemen!! If I can ever be of service, I'd be honored. Thanks again!!
    {{ DiscussionBoard.errors[7989583].message }}
  • Profile picture of the author kevintb7
    Can thread jack real quick. Is there any SEO reason not to do this with DNS records? It would seem to me adjusting the DNS would be even better than a 301 redirect for SEO.
    {{ DiscussionBoard.errors[8004946].message }}
Avatar of Unregistered

Trending Topics