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

Need a 301

Discussion in 'White Hat SEO' started by Mynarky, Jul 1, 2010.

  1. Mynarky

    Mynarky Registered Member

    Joined:
    May 15, 2010
    Messages:
    99
    Likes Received:
    29
    Location:
    Chicago
    I keep trying to create a 301 to merge my www and non-www sites. I use godaddy as a host and moniker to carry my domain, and I cant get this to work. I've tried htacess and nothing. Is there a simple code to accomplish this?
     
  2. bizroot

    bizroot Supreme Member

    Joined:
    Feb 25, 2008
    Messages:
    1,345
    Likes Received:
    912
    Location:
    In My Computer
    Check if your .htaccess code is correct or not...

    If you don't want to use www in your URL

    Code:
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} !^domain.com$ [NC]
    RewriteRule ^(.*)$ http://domain.com/$1 [L,R=301]
    If you want to use www in your URL

    Code:
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} !^www.domain.com$ [NC]
    RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]
    If you are still not getting it correct then it means you don't have permissions for it... It's called mod_rewrite rule... Ask your hosting service provider and they will solve problem for you...
     
    • Thanks Thanks x 1
  3. snwbrdstylee

    snwbrdstylee Registered Member

    Joined:
    Aug 12, 2008
    Messages:
    73
    Likes Received:
    22
    I have another question on this topic.

    How would I go about redirecting the .index.html file of a directory to just the directory name itself. For example:

    www yoursite com/about-us/index.html would only show as www yoursite com/about-us/

    When I try to change htaccess to do a redirect it gives me the error "Firefox has detected that the server is redirecting the request for this address in a way that will never complete."

    I am using the code: "Redirect 301 /about-us/index.html hxxp://www yoursite com/about-us/"
     
    Last edited: Jul 1, 2010
  4. Mynarky

    Mynarky Registered Member

    Joined:
    May 15, 2010
    Messages:
    99
    Likes Received:
    29
    Location:
    Chicago
    I dont think you actually need a 301 for this, couldn't use just use masking.
     
  5. bizroot

    bizroot Supreme Member

    Joined:
    Feb 25, 2008
    Messages:
    1,345
    Likes Received:
    912
    Location:
    In My Computer
    Could be several reason... You may not have permission for mod_rewrite...

    BTW different script need different way to solve that problem and you have to check your script... there are simple ways to solve this problem in many case otherwise you can always go back to .htaccess

     
  6. GreyWolf

    GreyWolf Executive VIP Jr. VIP

    Joined:
    Aug 17, 2009
    Messages:
    1,930
    Likes Received:
    5,387
    Gender:
    Male
    Occupation:
    Artist / Craftsman
    Location:
    sitting at my PC
    No, actually this is one of the recommended uses of a 301. Even google says you should do it, as well as set up the prefered url in webmaster tools.

    It sounds like the OP is just having trouble getting the syntax right.

    @OP - that just doesn't look right. It looks like your trying to use an alias directive. For a mod_alias directive you have to use the status 'permanent' not '301'. Also I'm not sure if you should use the filename in this instance. If that's the case then it should be more like
    Code:
    Redirect /about-us http://www.yoursite.com/about-us
    or
    Code:
    Redirect permanent /about-us http://www.yoursite.com/about-us
    Of course that's if your on an apache server.
    I use the mod_alias version myself sometimes, but it's usually recommended to use the mod_rewrite like what bizroot posted in his reply.

    Also I'm not sure why you would want to do it for just one page. If your going to use a redirect for choosing between www or non-www url then you really should do it globally so it takes care of all your pages.
     
    Last edited: Jul 6, 2010
  7. darkasrzerotwo

    darkasrzerotwo Registered Member

    Joined:
    May 23, 2010
    Messages:
    92
    Likes Received:
    10
    Occupation:
    Motion graphic designer
    If you use wordpress, use thesis theme. You can make 301 redirect instantly. Additional, use with wp hide post plugins.
     
    Last edited: Jul 7, 2010