0
votes

My project name is lsapp (which is inside htdocs) The problem is when I go to localhost or localhost/lsapp the directory of files is shown on the browser. I have setup up the C:\xampp\apache\conf\extra and modified httpd-vhosts.conf as required, Opened hosts files in C:\Windows\System32\drivers\etc and modified as required. I have checked several times for any typos etc. Everything in these files are now fine. And there is another file httpd.conf in which I have removed the # in the second line as follows.

.# Virtual hosts Include conf/extra/httpd-vhosts.conf

One thing is I have found two http.conf files, in the following different locations. All these files are similar. Do I have to do 1) C:\xampp\apache\conf (The setting is as below) .# Virtual hosts Include conf/extra/httpd-vhosts.conf

2) C:\xampp\apache\conf\original .# Virtual hosts .#Include conf/extra/httpd-vhosts.conf

Also there is one more http-vhosts.conf file inside C:\xampp\apache\conf\original\extra

IT HAS NO # AND IS AS FOLLOWS:

ServerAdmin [email protected]
DocumentRoot "${SRVROOT}/docs/dummy-host.example.com"
ServerName dummy-host.example.com
ServerAlias www.dummy-host.example.com
ErrorLog "logs/dummy-host.example.com-error.log"
CustomLog "logs/dummy-host.example.com-access.log" common

ServerAdmin [email protected]
DocumentRoot "${SRVROOT}/docs/dummy-host2.example.com"
ServerName dummy-host2.example.com
ErrorLog "logs/dummy-host2.example.com-error.log"
CustomLog "logs/dummy-host2.example.com-access.log" common

At this point Im not sure about the changes have to me made to these files.

I have restarted Apache and nothing changed.

No codes in this question

The public folder must be the root and the Directory must not be visible on the browser. On browser lsapp.test gives OBJECT NOT FOUND! ERROR 404 Also it automatically turns to http://lsapp.test/home

1

1 Answers

0
votes

This is how the above mentioned files should be setup:

(C:\xampp\apache\conf\extra) httpd-vhosts.conf

....
<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs/lsapp/public/"
    ServerName lsapp.dv
</VirtualHost>

(C:\Windows\System32\drivers\etc) hosts

127.0.0.1       localhost
127.0.0.1       test.com
127.0.0.1       lsapp.dv

(C:\xampp\apache\conf) httpd.conf

#Virtual hosts
Include conf/extra/httpd-vhosts.conf

When you open the upper file, remove the # character from the beginning of the line so that it should look like the above one.

Then restart your local server and go to browser and type in lsapp.dv.