Hostinger, document roots & your first PHP page
This lesson uses the real subdomain learn.nexsolve.digital as the laboratory. The objective is to understand exactly where files go and how a browser reaches them.
1. Learning goals
- Understand the relationship between a domain, hosting, folder, and URL.
- Know what a document root is.
- Understand why
index.phpopens automatically. - Create a working PHP test page.
- Recognize the difference between a filesystem path and a browser URL.
2. What happens when you open the subdomain?
When you enter https://learn.nexsolve.digital, the browser contacts the server. Hostinger maps that subdomain to its configured document-root folder. The server then looks for a default home file such as index.php or index.html.
3. Understand the document root
Your exact subdomain document root is determined by the Hostinger configuration. It may be a folder created for the subdomain rather than the primary site's main public_html. Always verify the subdomain's root in hPanel.
For this learning site, the ZIP contents should be extracted so that index.php is directly inside that document root.
4. Why index.php?
index.php is a common default homepage filename. PHP is executed on the server before the resulting HTML is sent to the browser.
If this file opens through your domain, you have confirmed that the subdomain routing and PHP processing are both working.
5. File paths and browser URLs
If the document root contains lessons/lesson-01.php, the browser path becomes:
The server folder itself is not typed into the public URL. The URL begins at the configured document root.
account and Account may be treated as different folders.6. Practice task
- Open Hostinger File Manager.
- Open the document root assigned to learn.nexsolve.digital.
- Confirm that this site's
index.phpis directly inside that folder. - Open https://learn.nexsolve.digital.
- Return here using the Lesson 01 button.
Next, create a temporary file called practice/php/hello.php with the following code:
Then open /practice/php/hello.php in your browser. Delete the temporary file after the test if you do not need it.
7. Success check
- The homepage opens without 403 or 404 errors.
- The design stylesheet loads.
- The dark/light button works.
- Lesson 01 opens from the homepage.
- You understand which Hostinger folder corresponds to the subdomain URL.