user269867
user269867

Reputation: 3952

setup a virtualhost on localhost

I am following the threads to set up a virtual host on stackoverflow. i did follwoing

<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot "C:/www/test"
    ServerName test.devsite-1.com
    ServerAlias test.devsite-1.com
</VirtualHost>

in windows host file

127.0.0.1   test.devsite-1.com

I hit following url in browser

http://test.devsite-1.com/

The resulting page shows me the listing of folder i.e localhost page... where as I was expecting it will show the content of index.php placed in /test folder?

Can someone correct me if I am interpreting something wrong?

Regards

Upvotes: 0

Views: 174

Answers (2)

Bruno Fl&#225;vio
Bruno Fl&#225;vio

Reputation: 778

If you are being shown the contents of your test folder then maybe you need to define index.php as an index.

You could attempt with a index.html file inside the directory first, but i believe you are missing the DirectoryIndex directive in your Virtualhost configuration.

Try adding:

DirectoryIndex index.html index.php

to your Virtualhost configuration.

Upvotes: 1

Sgoettschkes
Sgoettschkes

Reputation: 13189

Try adding

DirectoryIndex index.php

to your virtualhost.

BTW: I would recommend using some kind of test.devsite-1.local so you don't accidently block the real test.devsite-1.com.

Upvotes: 0

Related Questions