Setting up a home page on your localhost

In your ~/yourloginname/Sites directory, place the following code in a index.php file there.

BEWARE: this code is only intended to be functional, not pretty ... you've been warned :)

Functionally, it provides a vertical set of ugly green navigation buttons that take you to each different site (in a sub-folder) that you might be working with on your localhost

<!DOCTYPE html> 
<style type="text/css">
/*reset stuff*/
html, body, div, span, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
abbr, address, cite, code,
del, dfn, em, img, ins, kbd, q, samp,
small, strong, sub, sup, var,
b, i,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, figcaption, figure, 
footer, header, hgroup, menu, nav, section, summary,
time, mark, audio, video {

body {
  padding: 10px;

/*navigation stuff*/

ul.nav { 
  margin: 0; 
  padding: 0; 
  list-style-type: none;
  width: 15em;
  background-color: #88D400;

ul.nav a {
  display: block;
  color: #2B3F00;
  text-decoration: none;

  border-top:    1px solid #E4FFD3; 
  border-right:  1px solid #486B02; 
  border-bottom: 1px solid #486B02; 
  border-left:   1px solid #E4FFD3; 

  background: url(./arrow.gif) no-repeat 5% 50%; 
  padding: 0.3em 1.5em;

ul.nav .last a {
  border-bottom: 0px;

ul.nav a:hover, ul.nav a:focus, ul.nav .selected a {
  background-color: #6da203;

.phpinfo {
  font-family: monospace;
  color: #44b;

<h1>My Mac Name</h1>
<br />
<div class="phpinfo">
<?php echo "HTTP_HOST       = " . $_SERVER["HTTP_HOST"] ?><br />
<?php echo "DOCUMENT_ROOT   = " . $_SERVER["DOCUMENT_ROOT"] ?><br />
<?php echo "SCRIPT_FILENAME = " . $_SERVER["SCRIPT_FILENAME"] ?><br />
<br />
<ul class="nav">
$dir = '.'; 
$filelist = scandir($dir) or die ("Not a directory");
foreach ($filelist as $file) {
  if ($file != '.' && $file != '..') {
    if (!is_file("$dir/$file")) {
      // echo "$file is a directory" . "<br />";
      echo "<li>";
      echo "<a href=\"$file\">$file</a>";
      echo "</li>";
<br />
<div id="phpinfo"><?php echo phpinfo(); ?></div>

Make sure Apache on OSX is pointing to your own ~/yourloginname/Sites directory first (see my article Enabling Apache web server on Mountain Lion (OSX 10.8)). If you wish to have your server point somewhere else on your hard drive, then change the 1st line of this article to match your desired folder path