Search code examples
phpvirtual

ubuntu is redirecting all virtual hosts to https?


I have made a virtual host on Ubuntu and It is redirecting it to https. and virtual hosts not working.

here is virtual host settings:

<VirtualHost *:80>
     ServerName xserver.dev
     DocumentRoot /var/www/xserver/public
     SetEnv APPLICATION_ENV "development"
     <Directory /var/www/xserver/public>
         DirectoryIndex index.php
         AllowOverride All
         Require all granted
     </Directory>
     ErrorLog ${APACHE_LOG_DIR}/xx-error.log
     CustomLog ${APACHE_LOG_DIR}/xx-access.log combined
 </VirtualHost>

i have added it in /etc/hosts 127.0.0.1 xserver.dev

when I try to access xserver.dev It is redirecting me to https://xserver.dev and blank page

I am unable to access file files too. which are available on the given path


Solution

  • The .dev is a top-level domain name operated by Google.
    Since Chrome 63, and Firefox 59, the browsers redirects the .dev URLs to HTTPS.

    It is recommended to use .test, reserved by the Internet Engineering Task Force since 1999 (RFC2606).

    Change you virtual host to:

    <VirtualHost *:80>
         ServerName xserver.test
         DocumentRoot /var/www/xserver/public
         SetEnv APPLICATION_ENV "development"
         <Directory /var/www/xserver/public>
             DirectoryIndex index.php
             AllowOverride All
             Require all granted
         </Directory>
         ErrorLog ${APACHE_LOG_DIR}/xx-error.log
         CustomLog ${APACHE_LOG_DIR}/xx-access.log combined
     </VirtualHost>
    

    And your /etc/hosts to:

    127.0.0.1 xserver.test
    

    Then, access to your website : http://xserver.test