Porter
By:
Porter

Spring Cleaning (What is var/www/html)?

February 22, 2015 2.6k views

I'm just doing some premature Spring cleaning, and wanted to know what the var/www/html folder was for, and if I could delete it. My websites are currently located at var/www/site-name, and that html folder is just sitting there with them, containing an index.hmtl, and info.php files. I'm fairly certain it's just a default file from setup, but I wanted to be sure.

For the sake of education, let me know what created it (if not me, when I first started), and if I can remove it - thanks!

Using a LEMP stack.

2 comments
  • /var/www/html is the "default" directory things like Apache use as a webserver root.

    If you have nothing in it, then its normally safe to drop as you serve sites from a different folder.

    in all honesty, for simplicity what I tend to do is:
    Create a /var/www/html/index.php file ( The only file in that folder )

    And then place this in it..

    <?php
    header("HTTP/1.1 301 Moved Permanently");
    header("Location: http://www.New-Website.com");
    ?>

    This way if for whatever odd reason someone or something ends up being fed or relying on that directory existing, its redirected to one of my websites.

    Hope this helps.

  • Thanks, that confirms what I thought. As for that idea, not a bad idea, I might add that myself. It would actually be neat to log some info if anything did end up there, from number of visits, to whatever other information is available. Either way, at least I know it was indeed created as a default directory, and that I can alter / remove it if desired - thanks!

1 Answer

This question was answered by @IMsupporting:

/var/www/html is the "default" directory things like Apache use as a webserver root.

If you have nothing in it, then its normally safe to drop as you serve sites from a different folder.

in all honesty, for simplicity what I tend to do is:
Create a /var/www/html/index.php file ( The only file in that folder )

And then place this in it..

<?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.New-Website.com");
?>

This way if for whatever odd reason someone or something ends up being fed or relying on that directory existing, its redirected to one of my websites.

Hope this helps.

View the original comment

Have another answer? Share your knowledge.