With and Without WWW.

Discussion in 'Web Design and Development' started by virus187, Apr 30, 2009.

  1. virus187 macrumors newbie

    Joined:
    Apr 23, 2009
    #1
    Hi

    I am using iweb and have uploaded my site to godaddy via cyberduck which is all fine but when i type in my website URL without the www. it shows a slighty different version of the page (dont want this) than me entering www. You will know what I mean when you go to the 2 links below

    www.beats2buy.com - GOOD

    beats2buy.com - (Same URL but with the www.) - BAD

    Any suggestions on how to get the same thing with or without the www.?

    PS - there is no index page or welcome page. I jsut have made a home.html page, could this be the reason, do i need to rename the home.html to index.html?

    Thanks

    Virus 187
     
  2. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #2
    Besides the Ws I can't see a difference. Maybe your cache is not up to date with the page. You can set things so only with or without the Ws will be used. This is setup on the web host though, usually through the configuration somewhere.
     
  3. virus187 thread starter macrumors newbie

    Joined:
    Apr 23, 2009
    #3
    Hi AngelWatt

    Thanks for the reply,The thing is I tried this on someone elses computer at work via internet explorer and the same thing is happening, so you say its ok??

    the version of IE is 6.0.2

    How do I go about the comment you mentioned relating to my host (go daddy)

    Thanks
    Virus187
     
  4. design-is macrumors 65816

    design-is

    Joined:
    Oct 17, 2007
    Location:
    London / U.K.
    #4
    Just confirming both look the same to me too.

    I'm on Firefox 3.0.10 & Safari 3.2.1.

    Can you show us a screenshot?
     
  5. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #5
    I'm using Firefox 3.5b4 on Windows and the site looked the same with or without the www. Can you describe the difference you're seeing?

    I've never been with GoDaddy, so can't tell you where to go specifically to make the change I mentioned. Hopefully someone else here can give that info.

    Edit: Just tried with IE 6.0 and they look the same.
     
  6. TodVader macrumors 6502a

    TodVader

    Joined:
    Sep 27, 2005
    Location:
    Quebec, Canada
    #6
    You could put a .htaccess file to redirect all non-www adresses to the www version :

    HTML:
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^yourhost.com [NC]
    RewriteRule ^(.*)$ http://www.yourhost.com/$1 [L,R=301]
     
  7. virus187 thread starter macrumors newbie

    Joined:
    Apr 23, 2009
    #7
    Hi Tod

    Thanks for the info, ill try this. sorry to sound silly but i put godaddy where youve put yourhost?
     
  8. virus187 thread starter macrumors newbie

    Joined:
    Apr 23, 2009
    #8
    Hi Design-IS

    sorry how do i add an image without entering a URL in the message box?
     
  9. SrWebDeveloper macrumors 68000

    SrWebDeveloper

    Joined:
    Dec 7, 2007
    Location:
    Alexandria, VA, USA
    #9
    The IP is the same for the domain name with and without "www" so we know traffic for both is going to the same server (assuming no misconfig on the OP's network). I examined the sites through my MSIE and it's exactly the same. I even compared source code, no differences.

    Nothing to fix from what I can tell, the OP must have a cached copy in their browser or at the network level in their proxy or firewall if it exists - and usually the latter resolves itself within 72 hours of the last DNS change if any.

    Note: The .htaccess only works if the webhost has Apache and they've enabled .htaccess for your host. If so, replace yourhost.com in the example with beats2buy.com but after my testing, nothing wrong to fix so it's not necessary in my opinion.

    -jim
     
  10. MikhailT macrumors 601

    Joined:
    Nov 12, 2007
    #10
    Code:
    MikhailT-MBP:~ mikhailt$ dig beats2buy.com
    
    ; <<>> DiG 9.4.2-P2 <<>> beats2buy.com
    ;; global options:  printcmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 52711
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
    
    ;; QUESTION SECTION:
    ;beats2buy.com.            IN    A
    
    ;; ANSWER SECTION:
    beats2buy.com.        3581    IN    A    97.74.144.34
    
    ;; Query time: 2704 msec
    ;; SERVER: 208.67.222.222#53(208.67.222.222)
    ;; WHEN: Thu Apr 30 13:42:25 2009
    ;; MSG SIZE  rcvd: 47
    
    MikhailT-MBP:~ mikhailt$ dig www.beats2buy.com
    
    ; <<>> DiG 9.4.2-P2 <<>> www.beats2buy.com
    ;; global options:  printcmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 31205
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0
    
    ;; QUESTION SECTION:
    ;www.beats2buy.com.        IN    A
    
    ;; ANSWER SECTION:
    www.beats2buy.com.    3570    IN    CNAME    beats2buy.com.
    beats2buy.com.        3570    IN    A    97.74.144.34
    
    ;; Query time: 13 msec
    ;; SERVER: 208.67.222.222#53(208.67.222.222)
    ;; WHEN: Thu Apr 30 13:42:36 2009
    ;; MSG SIZE  rcvd: 65
    
    MikhailT-MBP:~ mikhailt$ 
    
    www is cnaming to beats2buy.com, so it is working fine on my end. It is more likely your cache or the web server doesn't have the correct config.
     
  11. FourCandles macrumors 6502a

    Joined:
    Feb 10, 2009
    Location:
    England
    #11
    This will also have the benefit of not splitting your domain traffic (traffic being split between a www. and non-www. version can lower your search engine rankings).
     
  12. TodVader macrumors 6502a

    TodVader

    Joined:
    Sep 27, 2005
    Location:
    Quebec, Canada
    #12
    -You create a file named .htaccess (nothing before the .)
    -You put it at the root of your website
    -If your site is www.MySite.com, you replace "yourhost" by "mysite".

    For your situation, here's your code:
    HTML:
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^beats2buy.com [NC]
    RewriteRule ^(.*)$ http://www.beats2buy.com/$1 [L,R=301]
     
  13. virus187 thread starter macrumors newbie

    Joined:
    Apr 23, 2009
    #13
    ToVader

    Thank you and everyone else for your input, ToVader I will try your method now. Can I create this file is Dreamweaver CS3 and then rename it .htaccess?

    Also anyone reading this i have found a new problem with the same issue

    if you go to beats2buy.com try click on the menu links and see if they work and let me know

    I know that the menu links work for www.beats2buy.com but try the other and let me know

    PS - I have made a intro page to the site, very clean and simple but why is that when I click on enter everything else still takes alittle time to load? I thought the intro page was to "distract the user" whilst the homepage loads up

    Thanks
    Virus 187
     
  14. virus187 thread starter macrumors newbie

    Joined:
    Apr 23, 2009
    #14
    Ok tried this and it doesnt rename the URL to www.beats2buy.com

    here is how i did it

    i opended text edit, then added the code, then renamed it to .htaccess but it said something about . files being hidden so therefore i wouldnt be able to find it if i wanted to upload it onto go daddy, SO i made a folder called ht and then saved it into that and uploaded the folder to godaddy.

    Why isnt it working or does it take time?

    Virus 187
     
  15. design-is macrumors 65816

    design-is

    Joined:
    Oct 17, 2007
    Location:
    London / U.K.
    #15
    You need to have the file in the root of your site (www.beats2buy.com, not www.beats2buy.com/ht) and it needs to be called .htaccess. Try uploading it as htaccess and renaming it once it's up. Depending on how your doing it (web access, FTP client etc.) there may also be a way to turn on the ability to see hidden files.

    The issue with your navigation where it won't work on beats2buy.com may be that it's a flash file and something is a bit weird in it somewhere...
     
  16. FourCandles macrumors 6502a

    Joined:
    Feb 10, 2009
    Location:
    England
    #16
    Files starting with a . are hidden files in Linux (which is probably what your host is using) and Unix, which is the core of OS X (hence the warning).

    As design-is said, try saving the file under a different name and uploading, then changing the name with Cyberduck.

    If you need to make further edits once it's there, if you install TextWrangler (free) then this will work with Cyberduck and allow you to browse to the .htaccess file, right/control click and open it directly for editing (actually it downloads a temporary copy, saves it locally and then uploads once you've saved, but it all happens in the background).

    If you do download .htaccess with Cyberduck, be careful to "download as..." and not just "download". Otherwise it will download the file still called .htaccess, which OS X will promptly hide away from you...

    Oh, and make sure Cyberduck is set to show hidden files (Preferences:Browser).
     
  17. TodVader macrumors 6502a

    TodVader

    Joined:
    Sep 27, 2005
    Location:
    Quebec, Canada
    #17
    Can't you just turn on hidden files on your mac and then upload it like a regular file by FTP?

    To do this, open your terminal and enter those commands:

    HTML:
    defaults write com.apple.finder AppleShowAllFiles TRUE
    killall Finder
    Hidden files will now be visible. Replace TRUE with FALSE to put it back like it was after if you find them anoying.
     
  18. FourCandles macrumors 6502a

    Joined:
    Feb 10, 2009
    Location:
    England
    #18
    Indeed you can, or you can use Tinkertool to achieve the same result. I just find the Cyberduck/TextWrangler method to be simpler.
     
  19. SrWebDeveloper macrumors 68000

    SrWebDeveloper

    Joined:
    Dec 7, 2007
    Location:
    Alexandria, VA, USA
    #19
    Good point. I wish to expand on this.

    Unless absolutely required, developers should rarely hard code domains into their source. Hoping the OP didn't do that here in their Flash.

    It's much easier often to use server global variables, i.e. in PHP with Apache web server $_SERVER['SERVER_NAME'] will equal www.yourdomain.com typically. That's why they're there. Also, always use relative paths for links within your own site, i.e. use "/" for root, or "/mypage.html" for mypage.html off the root, or "/path_to/mypage.html" if elsewhere. Not, "http://www.yourdomain.com/mypage.html" in your href for an anchor tag. Same for linking images, XML files, stylesheets and so on. This obviously pays dividends if the domain name changes over time.

    -jim
     
  20. FourCandles macrumors 6502a

    Joined:
    Feb 10, 2009
    Location:
    England
    #20
    FWIW I've just noticed that TextWrangler can open local hidden files directly:
    File > Open Hidden...
     

Share This Page