Search code examples
phpwebxampp

How to point to project index page by default in XAMPP


i am pretty new this kind of work. I had developed a web app using PHP. i am using XAMPP Server. Now when i am hitting http://www.mywebsite.com/myproject i got my project index page. Now what i looking is if i enter http://www.mywebsite.com it should display myproject's index page.

I am not sure what is this term called. I didn't know how to search for this solution.

Your help will be much appreciated if you can provide the term i should look for or the solution for this.

thanks


Solution

  • When you edit the httpd-vhosts.conf file (which is in C:\xampp\apache\conf\extra), edit the DocumentRoot property accordingly.

    Your current settings are probably looking like this:

    <VirtualHost *:80>
        DocumentRoot "C:/xampp/htdocs"
        ServerName www.mywebsite.com
    </VirtualHost>
    

    which directs you to the main htdocs folder. In order to display your project, you use www.mywebsite.com/myproject. You should change the DocumentRoot. For example:

    <VirtualHost *:80>
        DocumentRoot "C:/xampp/htdocs/your-project-folder"
        ServerName www.mywebsite.com
    </VirtualHost>
    

    Tested on Win 8.1 Pro x64, XAMPP 5.6.21 portable. It's working.