Subdomains and a New Host - A Short Story

Discussion in 'Site & Server Administration' started by roadkillu, Mar 7, 2007.

  1. #1
    Back in the day I created about 100 subdomains, thinking they would rank better for local search type stuff.

    Well, I just moved hosts. (to dreamhost from yahoo...I can edit htaccess! yay!)

    My question. I would like to get rid of the sub-domains, but many of them rank very well for their assigned keywords. They will not match my new site design at all though. So, is there a way to say create a new page on my new CMS (wordpress, i love it), like mydomain/new-page. And then 301 the subdomain newpage.mydomain?

    Or am I up a creek?

    Thanks.
     
    roadkillu, Mar 7, 2007 IP
  2. roadkillu

    roadkillu Peon

    Messages:
    52
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Also, all my older pages were hand created (mostly) in notepad. for example, our about me page is about.html. I'd like to have an about page on the new design, but it will only allow mydomain.com/about.

    Can I redirect the about.html to the mydomain.com/about or will this happen automatically? It's a nice PR4 page (the about.html), so I'd like to keep it.
     
    roadkillu, Mar 7, 2007 IP
  3. rodney88

    rodney88 Guest

    Messages:
    480
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Sure it's possible. If you can access your domain from anything.domain.com, you can put everything in one .htaccess file in the root of your domain.

    You would need something like:
    #Enable rewriting
    Options +FollowSymLinks
    Options +Indexes
    RewriteEngine On
    RewriteBase /
    
    # 301 redirect anything.domain.com to domain.com/anything
    RewriteCond %{HTTP_HOST} (www\.)?(.+)\.domain\.com
    RewriteRule .* http://www.domain.com/%2 [L,R=301]
    
    # 301 redirect about.html to about
    RewriteRule ^about\.html$ http://www.domain.com/about [L,R=301]
    Code (markup):
     
    rodney88, Mar 7, 2007 IP