Page 1 of 2 12 LastLast
Results 1 to 10 of 14
  1. #1
    Join Date
    Jan 2007
    Posts
    23
    Plugin Contributions
    0

    Default Windoews 8 XAMPP setup ...\etc\hosts config ok but www.example.com doesn't redirect

    I'm net to XAMPP. I've just installed XAMPP and configured the C:\Windows\System32\drivers\etc\hosts file with

    127.0.0.1 http://www.example.com # for browser access


    but with internet explorer http://www.example.com/ just displays the "Example Domain" display.


    Can anyone advise how I can correct this?


    Thanks


    John

  2. #2
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,761
    Plugin Contributions
    9

    Default Re: Windoews 8 XAMPP setup ...\etc\hosts config ok but www.example.com doesn't redire

    example.com is just that an example

    Usually with xamp you get to your test site using http://localhost/
    Zen-Venom Get Bitten

  3. #3
    Join Date
    Feb 2012
    Location
    mostly harmless
    Posts
    1,809
    Plugin Contributions
    8

    Default Re: Windoews 8 XAMPP setup ...\etc\hosts config ok but www.example.com doesn't redire

    Correct syntax for a host file would be:
    Code:
    127.0.0.1 domain.local www.domain.local
    The hosts file maps IP Address(es) to domain names... So skip the scheme, colon, and two slashes (http:// or https://). May need to reboot your computer afterwards for the changes to take effect.

    I would recommend NOT mapping real domain names to the loopback IP. Better to avoid any confusion by using a completely fake domain name (also makes DNS resolution on the local computer simpler).

    If you plan to set up multiple local development sites, don't forget to set up VirtualHosts (and separate document roots) for each development site in Apache.

  4. #4
    Join Date
    Jan 2007
    Posts
    23
    Plugin Contributions
    0

    Default Re: Windoews 8 XAMPP setup ...\etc\hosts config ok but www.example.com doesn't redire

    Thanks korba and lhungil for your advice - actually, I'm following the Zen Cart book by Goh Koon Hoek. My hosts file is now configured as follows, but still www.example.com/ does not work. [localhost has always redirected to http://localhost/xampp/ and works file, displaying the XAMPP for Windows screen] If possible, I would like follows the examples shown in this book.

    # Copyright (c) 1993-2009 Microsoft Corp.
    #
    # This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
    #
    # This file contains the mappings of IP addresses to host names. Each
    # entry should be kept on an individual line. The IP address should
    # be placed in the first column followed by the corresponding host name.
    # The IP address and the host name should be separated by at least one
    # space.
    #
    # Additionally, comments (such as these) may be inserted on individual
    # lines or following the machine name denoted by a '#' symbol.
    #
    # For example:
    #
    # 102.54.94.97 rhino.acme.com # source server
    # 38.25.63.10 x.acme.com # x client host

    # localhost name resolution is handled within DNS itself.
    # 127.0.0.1 localhost
    16:39 16/05/2015# ::1 localhost
    #
    #127.0.0.1 http://www.example.com # for browser access
    127.0.0.1 www.example.com # for browser access
    127.0.0.1 mail.example.com # for mail access
    127.0.0.1 example.com # for mercury mail server

  5. #5
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,586
    Plugin Contributions
    30

    Default Re: Windoews 8 XAMPP setup ...\etc\hosts config ok but www.example.com doesn't redire

    I would like follows the examples shown in this book.
    I remember that phase many moons ago. example.com will work but change to something yours asap, like www.mysite.local.

    16:39 16/05/2015# ::1 localhost
    #
    #127.0.0.1 http://www.example.com # for browser access
    127.0.0.1 www.example.com # for browser access
    127.0.0.1 mail.example.com # for mail access
    127.0.0.1 example.com # for mercury mail server
    Get rid of the debris in red, whatever that is.
    When I tried this, www.example.com arrived at the Xampp front page, as it should. No restart necessary (Win7).
    If yours doesn't...I don't know. You are editing the file as administrator?

    Now you have to configure the Xampp apache server so it knows what to do when presented with www.example.com: which files to serve up for that domain, using a virtualhost.

    While I am the first to tell people to google it, I do remember some pain in getting this to work...
    You can use an alias or virtualhost. I found an alias worked up until I started to use URI remapping then had to man up to get a virtualhost working so better to do it now.

    Make sure you restart apache after every change so you know when you have broken something.

    Enable SSL:
    Code:
    C:\xampp5680-portable\apache\conf\httpd.conf
    LoadModule ssl_module modules/mod_ssl.so

    And this is my C:\xampp5680-portable\apache\conf\extra\httpd-vhosts.conf
    with some names changed to protect the innocent.

    Code:
    ##for all non-matching
    <VirtualHost *:80>
        ServerAdmin [email protected]
        DocumentRoot "/xampp5680-portable/htdocs"
        ServerName localhost
    </VirtualHost>
    
    
    ## for all non-matching: SSL
    <VirtualHost *:443>
        ServerAdmin [email protected]
        DocumentRoot "/xampp5680-portable/htdocs"
        ServerName localhost
            SSLEngine on
            SSLCertificateFile conf/ssl.crt/server.crt
            SSLCertificateKeyFile conf/ssl.key/server.key
    </VirtualHost>
    
    
    <VirtualHost *:80>
       ServerName www.mysite.local
       ServerAlias www.mysite.local
       DocumentRoot "D:/My Documents/Business/Mysite/spanish website/home/public_html"
       ErrorLog "logs/vhost-error.log"
       CustomLog "logs/vhost-access.log" combined
            <Directory "D:/My Documents/Business/Mysite/spanish website/home/public_html">
                    AllowOverride All
                    Require all granted
            </Directory>
    </VirtualHost>
    
    
    <VirtualHost *:443>
       ServerName www.mysite.local
       ServerAlias www.mysite.local
               SSLEngine on
            SSLCertificateFile conf/ssl.crt/server.crt
            SSLCertificateKeyFile conf/ssl.key/server.key
       DocumentRoot "D:/My Documents/Business/Mysite/spanish website/home/public_html"
       ErrorLog "logs/vhost-error.log"
       CustomLog "logs/vhost-access.log" combined
            <Directory "D:/My Documents/Business/Mysite/spanish website/home/public_html">
                AllowOverride All
                Require all granted
            </Directory>
    </VirtualHost>
    I've probably forgotten something.

    As for the mail servers etc. forget them for the moment. Once you have smtp settings in the shop admin you can use real addresses and the emails will work.
    Steve
    github.com/torvista: Spanish Language Pack, Google reCaptcha, Structured Data, Multiple Copy-Move-Delete, Image Checker, BackupMySQL Admin/Auto...

  6. #6
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,761
    Plugin Contributions
    9

    Default Re: Windoews 8 XAMPP setup ...\etc\hosts config ok but www.example.com doesn't redire

    but still www.example.com/ does not work
    And never will as it is an EXAMPLE

    xamp does not use or require or use a domain name

    If localhost then you must have zencart in another directory so

    http://localhost/"your_ZenCart_directory_name"
    Zen-Venom Get Bitten

  7. #7
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,474
    Plugin Contributions
    88

    Default Re: Windoews 8 XAMPP setup ...\etc\hosts config ok but www.example.com doesn't redire

    FWIW, I don't even mess with the hosts file when configuring XAMPP local testbeds. I just create a /includes/local/configure.php file that contains the XAMPP based configuration (and the corresponding /admin/includes/local/configure.php). Those files "override" your webhosted settings.

    I then access the "website" as localhost/zen_cart_directory_name.

    Cindy

  8. #8
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,586
    Plugin Contributions
    30

    Default Re: Windoews 8 XAMPP setup ...\etc\hosts config ok but www.example.com doesn't redire

    I then access the "website" as localhost/zen_cart_directory_name
    So you have a virtualhost per dev site to "catch" that url/address?
    Steve
    github.com/torvista: Spanish Language Pack, Google reCaptcha, Structured Data, Multiple Copy-Move-Delete, Image Checker, BackupMySQL Admin/Auto...

  9. #9
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,474
    Plugin Contributions
    88

    Default Re: Windoews 8 XAMPP setup ...\etc\hosts config ok but www.example.com doesn't redire

    Quote Originally Posted by torvista View Post
    So you have a virtualhost per dev site to "catch" that url/address?
    Nope, my XAMPP installation is pretty minimal. Each site (as customized via the /local/configure.php files) is simply accessed as http://localhost/folder_name, with the Zen Cart installation files being present in c:/xampp/htdocs/folder_name.

  10. #10
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,586
    Plugin Contributions
    30

    Default Re: Windoews 8 XAMPP setup ...\etc\hosts config ok but www.example.com doesn't redire

    with the Zen Cart installation files being present in c:/xampp/htdocs/folder_name.
    Gosh, I have been so long using alias' and virtual hosts that I never considered that!

    I decided at the onset I didn't like that setup. I have six sites and wanted each website in the same directory as everything else related to that activity/business in D:My Documents etc. for various reasons:
    a) keeping my data out of the C drive/all in one logical place for backups.
    b) synchronisation purposes: I sync to five pcs and may have to use any one of them. While each has a Xampp installation, having the website files separate means I can use any pc for development. Using the same virtual host definition on each makes this easy.
    c) I always use the latest Xampp but keep older ones, so can have multiple Xampps with the one set of website files.
    Steve
    github.com/torvista: Spanish Language Pack, Google reCaptcha, Structured Data, Multiple Copy-Move-Delete, Image Checker, BackupMySQL Admin/Auto...

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v151 Configuring my email client on xampp-win32 for example.com
    By kaybe in forum General Questions
    Replies: 2
    Last Post: 26 Apr 2016, 12:59 PM
  2. Error 404 accessing example.com/store in xampp tutorial
    By mbielin in forum Installing on a Windows Server
    Replies: 6
    Last Post: 11 Nov 2010, 10:24 AM
  3. set up standalone "example.com" domain in Windows XP - editing hosts file
    By lieven23 in forum Installing on a Windows Server
    Replies: 7
    Last Post: 16 Jan 2009, 08:16 AM
  4. http://www.example.com not working
    By John Zwikstra in forum Installing on a Windows Server
    Replies: 8
    Last Post: 31 Aug 2008, 06:13 AM
  5. example.com ----> www.example.com
    By canemasters in forum General Questions
    Replies: 4
    Last Post: 7 Jun 2007, 07:20 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR