A Guard Dog For a Web File Directory
Difficulty: 4 (rated by author; 1=easy <--> 5=difficult)
Views: 133
Type: Domain Building, Security
Sometimes in your domain building you will end up with a web directory structure that leaves a bunch of files exposed publicly. You may not want that.
This happens when you install the Yourls app — for example, visit the demo one at https://jump.extendlabs.ca/ Or when we created a Sandbox for our development work, the main directory representing the subdomain sandbox.gadgets.stateu.org
has no web content in it.
This is not very pretty! But it also means that people can snoop inside your web sites if they see this directory view, merely by navigating to the top of the subdomain web address. This happens in a web server when there is no index.html
, index.php
, or default.html
file in there, you just see files.

One way to avoid showing this web directory is to place an empty content index.html
file inside the directory for the subdomain. But we offer something a little more showy, a protective dog.
With a simple set of two files added to that directory, you can create a guard dog (or whatever image you like) to make as a page to block the file view. It uses a little bit of code called backstretch that scales a background image to fill the window side.
These are the 2 files you will get in this package (download the package now):
- background.jpg
- index.html
You can replace the background.jpg file with any other image (rename it the same name!); something at least 1024 x 768px will do well. And now if you are feeling brave, open the index.html
file in a plain text editor, and edit any of the content inside the <div id="stuff">
section:
<div id="stuff"> <!-- edit ahoy --> <!-- the big title --> <h1> CogDogBlog Lab </h1> <!-- a clever tagline --> <p> Be Careful </p> <!-- give credit for the image! --> <p class="small"> cc licensed ( BY ) flickr photo by Perfecto Insecto: <a href="http://flickr.com/photos/perfectoinsecto/4301508866/"> http ://flickr.com/photos/perfectoinsecto/4301508866/</a> </p> <!-- done editing --> </div>
Use the Cpanel File Manager to uploads these two files to the directory you are guarding, and enjoy the beauty of your cleverness.
Example for "A Guard Dog For a Web File Directory":
https://lab.cogdogblog.com/