Sunday, April 3, 2022

[SOLVED] Virtual Host not pointing properly

Issue

I have installed Laravel at C:/Apache24/htdocs/lsapp.

It's working fine with localhost/lsapp/public URL.

What I want to do is instead of above URL I want to access it by mak.org on my local machine.

For that I did following changes

  1. Edited C:/Apache24/conf/extra/httpd-vhosts.conf with below lines:

    <VirtualHost *:80>
        DocumentRoot "C:/Apache24/htdocs"
        ServerName localhost
    </VirtualHost>
    
    <VirtualHost *:80>
        DocumentRoot "C:/Apache24/htdocs/lsapp/public"
        ServerName mak.org
    </VirtualHost>
    
  2. Edited C:/Windows/System32/drivers/etc/hosts with below lines:

    127.0.0.1       localhost
    127.0.0.1       mak.org
    
  3. I restarted my apache server.

But when I hit mak.org in browser, instead of accessing "C:/Apache24/htdocs/lsapp/public" it is pointing to "C:/Apache24/htdocs".

I restarted my PC, enabled opcache.enable=0 in php.ini still not getting desired outcome.

Can anybody help me on this? What or where am I missing?


Solution

The issue resolved by enabling below in httpd.conf file of Apache:

    Include conf/extra/httpd-vhosts.conf


Answered By - Mak_091
Answer Checked By - Cary Denson (WPSolving Admin)