0

I use Xampp to give me a localhost environment for testing PHP. I recently set up a virtual host in the httpd-vhosts.conf file of xampp so that I could seperate projects into their own domain name space - my virtual host description is below:

NameVirtualHost *
<VirtualHost *>
    DocumentRoot "C:\xampp\xampp\htdocs"
    ServerName localhost
</VirtualHost>
<VirtualHost *>
    DocumentRoot "C:\xampp\xampp\htdocs\sales_dev2"
    ServerName sales.dev
    <Directory "C:\xampp\xampp\htdocs\sales_dev2">
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>
<VirtualHost *>
    DocumentRoot "C:\xampp\xampp\htdocs\opencart"
    ServerName opencart.local
    <Directory "C:\xampp\xampp\htdocs\opencart">
        Order allow,deny
        Allow from all
    </Directory>  
</VirtualHost>

I also edited my hosts file so that each of the ServerName's described would resolve to 127.0.0.1.

This setup works fine in FireFox and IE, but in Chrome the ServerName's that do not follow a recognised TLD are instead resolving to a google search for that string (google search 'opencart.local' for instance)

Can anyone please advise on how to resolve this?

3

2 Answers 2

0

.dev has a lot of unfortunate luggage attached, such as chrome demanding your use https with it even if your application really doesn't need it. Much better to use a proper solution such as .localhost.

The RFC states this:

To safely satisfy these needs, four domain names are reserved as
listed and described below.

               .test
            .example
            .invalid
          .localhost

  ".test" is recommended for use in testing of current or new DNS
  related code.

  ".example" is recommended for use in documentation or as examples.

  ".invalid" is intended for use in online construction of domain
  names that are sure to be invalid and which it is obvious at a
  glance are invalid.

  The ".localhost" TLD has traditionally been statically defined in
  host DNS implementations as having an A record pointing to the
  loop back IP address and is reserved for such use.  Any other use
  would conflict with widely deployed code which assumes this use.
-1

you can type .dev at the end of your Vhost name. it will be solved and google never search anything.

and also type following ip in your host files.(may work, not sure) ::1 yourvhost

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .