Skip to content

Instantly share code, notes, and snippets.

@rob-mcgrail
Last active August 29, 2015 14:13
Show Gist options
  • Select an option

  • Save rob-mcgrail/4454d73e963169d487e6 to your computer and use it in GitHub Desktop.

Select an option

Save rob-mcgrail/4454d73e963169d487e6 to your computer and use it in GitHub Desktop.
/var/www/index.php apache welcomepage with linked /etc/hosts
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap -->
<link href="//maxcdn.bootstrapcdn.com/bootswatch/3.3.1/flatly/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="row page-header jumbotron">
<div class="col-lg-6">
<h1>It Works!</h1>
<hr />
<a class="btn btn-lg btn-default" href="/info.php">php info</a>
<a class="btn btn-lg btn-default" href="/phpmyadmin">phpmyadmin</a>
<hr/>
<pre><?php
$hosts = file_get_contents('/etc/hosts');
echo preg_replace('(\w*?\.?\w*?\.?\w*?\.?localhost)', '<a href="http://$0">$0</a>', $hosts);
?>
</pre>
</div>
</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment