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

.htaccess 301 redirect question

Discussion in 'White Hat SEO' started by sky11, May 3, 2013.

  1. sky11

    sky11 Registered Member

    Joined:
    Apr 22, 2013
    Messages:
    51
    Likes Received:
    1
    Hello,

    Google is indexing my domain's dedicated ip and not my actual domain name in some posts.

    some days before I have added a non-w w w to w w w 301 redirect.

    but now I also want to redirect ip to w w w.

    Please advice me how can I do it.

    Thanks
     
  2. Izzma

    Izzma Regular Member

    Joined:
    Jan 29, 2012
    Messages:
    293
    Likes Received:
    197
    Location:
    Canada
    <IfModule mod_rewrite.c>
    Options +FollowSymLinks
    RewriteEngine on

    RewriteCond %{HTTP_HOST} !^www\. [NC]
    RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

    </IfModule>

    That should do yeah. I have never has any issue with an IP coming up this way.
     
    Last edited: May 3, 2013
  3. Panther28

    Panther28 Elite Member

    Joined:
    May 2, 2010
    Messages:
    2,268
    Likes Received:
    3,405
    Occupation:
    Internet.
    Location:
    Internet.
    when you say they are "indexing" your ip, how exactly do you know this? Where does it show?
     
  4. Panther28

    Panther28 Elite Member

    Joined:
    May 2, 2010
    Messages:
    2,268
    Likes Received:
    3,405
    Occupation:
    Internet.
    Location:
    Internet.
    I think maybe he already has that setup
     
  5. Izzma

    Izzma Regular Member

    Joined:
    Jan 29, 2012
    Messages:
    293
    Likes Received:
    197
    Location:
    Canada
    Yes your probably right, but I do not understand the IP part. Never had an issue like that before with .htaccess. Is your DNS configured properly? You can check your DNS resolving at http://www.intodns.com

    OP, why would you want to redirect your IP to WWW? Are you forwarding your domain to a WAMP type host with no NameServers?
     
    Last edited: May 3, 2013
  6. sky11

    sky11 Registered Member

    Joined:
    Apr 22, 2013
    Messages:
    51
    Likes Received:
    1
    I have already added non-w w w to w w w 301 redirect.
    but I also want to add ip to w w w redirect.

    want to now that if I want to redirect my ip to my domain then can I type another two lines in the below of the upper mention lines only by changing the first line domain to my ip ?
     
  7. Panther28

    Panther28 Elite Member

    Joined:
    May 2, 2010
    Messages:
    2,268
    Likes Received:
    3,405
    Occupation:
    Internet.
    Location:
    Internet.
    just test it mate, put it in and try
     
  8. semxpert

    semxpert Newbie

    Joined:
    Sep 16, 2011
    Messages:
    24
    Likes Received:
    3
    Occupation:
    CEO of "SEMxpert", German based Searchenginemarket
    Location:
    Germany
    Home Page:
    Beware of "double content penalization" if your domain is reachable with "www" also
     
  9. Endire

    Endire Elite Member Premium Member

    Joined:
    Mar 27, 2012
    Messages:
    1,756
    Likes Received:
    1,061
    Gender:
    Male
    Sky,

    If you have a redirect set up, you already are redirecting your IP address to another one because a domain name acts as an easy-to-understand wrapper for an IP address. I think you may need to describe your problem a little better for anyone to help you.

    When you say your domains?s dedicated IP is being indexed, it is not clear what you mean by that. Are there characters that are showing up in SERP?s that you don?t want to show up? If so, a redirect will not solve this issue. You have to change the source of where Google is pulling that information from (usually from your pages but can come from your host in regards to domain names).

    You might be able to find some other ideas in this thread,

    http://www.webmasterworld.com/google/4327200.htm

    Or here, http://www.searchenginejournal.com/3-ways-to-make-your-serp-listing-stand-out/59961/

    Best,

    Shawn
     
    Last edited: May 3, 2013
  10. Stufferizer

    Stufferizer Regular Member

    Joined:
    Nov 6, 2012
    Messages:
    237
    Likes Received:
    73
    Did you actually read even the first post of this thread?
     
  11. blackberry

    blackberry Power Member

    Joined:
    Apr 26, 2009
    Messages:
    675
    Likes Received:
    218
    Occupation:
    Making money
    Location:
    Planet Earth
    He is talking about "IP canonicalization"


    Here is how you do it:

    # Start Ensure www on all URLs and ip canonicalization to same host
    RewriteCond %{HTTP_HOST} ^111\.222\.222\.111
    RewriteCond %{HTTP_HOST} ^example.com [NC]
    RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
    # End
     
    • Thanks Thanks x 1