What is web root?

When talking about a web server, the web root is the topmost (or “highest”) directory on that web server where the files are served from. So, the web root is always a specific directory on a web server – see below for more details on what that directory is typically called and where it might be on your own web server. For example, for a site like www.programmerinterview.com, if I add a create a new file titled justtesting.php and put it inside the web root of the web server where programmerinterview.com is hosted, then I could just go to www.programmerinterview.com/justtesting.php in order to see the file. But, if I put the file in a directory called somedirectory that exists in the web root directory, then any files created in the somedirectory directory will be under www.programmerinterview.com/somedirectory/.




Where is the web root on a server?

It really depends on your server configuration, but it’s usually under a directory called public_html or www. For example, Apache users often have their web root under /home/userName/public_html.

Hiring? Job Hunting? Post a JOB or your RESUME on our JOB BOARD >>

Subscribe to our newsletter for more free interview questions.