Skip to content

Instantly share code, notes, and snippets.

@jamieparfet
Created July 13, 2020 19:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamieparfet/dcc7105c32f144b2c03176939621720f to your computer and use it in GitHub Desktop.
Save jamieparfet/dcc7105c32f144b2c03176939621720f to your computer and use it in GitHub Desktop.
Simple PHP server to redirect to specified location based on requested extension
<?php
// php -S 0.0.0.0:8000 router.php
// http://host/x.jsp?u=http://example.com
if (preg_match('/\.(?:jsp)/', $_SERVER["REQUEST_URI"])) {
$location = $_GET['u'];
Header("Location: ".$location);
} else {
echo "error";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment