1<?php
2
3$host = $_SERVER['HTTP_HOST'];
4
5preg_match("#^(.*)/[^/]*$#", $_SERVER['REQUEST_URI'], $matches);
6$uri = $matches[1];
7
8header("Location: http://${host}${uri}/demo/index.php");
9
10?>