How to solve this.

Discussion in 'HTML & Website Design' started by tenthirty, Jun 28, 2008.

  1. #1
    I'm having some problem here.Its showing two different site when I type http://www.mydomain.com and http://mydomain.com
    I have been trying to solve it but can't, I'm using hostgator, I have remove the files that is in http://www.mydomain.com but its still showing.I want the site that is on http://mydomain.com to be on http://www.mydomain.com also.Anyone can help ?

    Thanks.
     
    tenthirty, Jun 28, 2008 IP
  2. dannet

    dannet Well-Known Member

    Messages:
    864
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    153
    #2
    You can solve it with a htaccess redirection, try it:

    Options +FollowSymLinks
    RewriteEngine On
    
    RewriteCond %{HTTP_HOST} ^mydomain\.com$ [NC]
    RewriteRule ^(.*)$ http://www.mydomain.com/$1 [R=301,L]
    Code (markup):
    So, when a visitor go to mydomain .com its redirected to www. mydomain .com

    Other way could be to define a base path in your code <head>:

    <base href="http://www.mydomain.com/">
    Code (markup):
     
    dannet, Jun 28, 2008 IP
  3. tenthirty

    tenthirty Peon

    Messages:
    73
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thanks, I will try it out.
     
    tenthirty, Jun 28, 2008 IP
  4. Talker

    Talker Notable Member

    Messages:
    2,795
    Likes Received:
    108
    Best Answers:
    0
    Trophy Points:
    210
    #4
    Here is how i do it on all my domains.



    
    RewriteEngine on
    rewriteCond %{HTTP_HOST} ^(www\.)?yourdomain\.com$ [NC]
    rewriteRule ^(.*)$ https://www.yourdomain.com/$1 [R=301,L]
    
    RewriteCond %{SERVER_PORT} 80 
    RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [R,L]
    
    
    HTML:
    the first set will redirect yourdomain.com to https://www.yourdomain.com (remove the s in https if you want it to go to http)

    and the second set of lines will redirect http to https

    Hope this help you .. best of luck !
     
    Talker, Jun 28, 2008 IP
  5. tenthirty

    tenthirty Peon

    Messages:
    73
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thanks Talker, I'm in total confusion right now.I have remove all the files, I have even remove the domain but the files on http:// www .mydomain. com is still showing on the internet !! I just don't understand how to shut it.If there is anyone free here, can you please add me on msn - nipoker (at) hotmail. com and try help me out.

    Thanks
     
    tenthirty, Jun 28, 2008 IP
  6. Talker

    Talker Notable Member

    Messages:
    2,795
    Likes Received:
    108
    Best Answers:
    0
    Trophy Points:
    210
    #6
    Added you to messenger.. please accept.
     
    Talker, Jun 28, 2008 IP