PHP Script changing URL structure in all directories
I was just given access to a development server. I created a directory in the public_html folder called "test-site". When I visit http://developmentdomain.com/test-site/ the URL string becomes: http://developmentdomain.com/test-site/?p=test-site
The reason this is happening is because index.php in the root directory is telling all sub directories to add this on the end of the URL. The main site (hosted in the root) needs this file, but I do not want all of the other sub directories to be affected by it. How would I change the following code so it only applies to the root, bot not sub directories? This line is what is causing it: $p = ($_REQUEST['p'] != '' ? $_REQUEST['p'] : 'home');
<? session_start(); $_SESSION['bj'] = 1; include "db.php"; require_once("classes/layout.class.php"); require_once("classes/content.class.php"); $p = ($_REQUEST['p'] != '' ? $_REQUEST['p'] : 'home'); $layout = new layout(); $layout->startPage($p); $layout->buildHead($p); $layout->buildBody($p); $content = new content(); $content->buildHeader($p); $content->buildLogoNav($p); $content->buildPage($p); $content->buildFooter($p); $layout->closePage($p); ?>
It appears that the $_GET parameter is being used as a custom CMS.
- Check any rewrite rules.
- Review the layout() class
- Review your server-side includes classes/layout.class.php & classes/content.class.php
The URL is being modified at some point programatically. Assuming its not a problem due to #1, then keep an eye out for a portion of code that manipulates the header(), i.e. header('Location: some/new/location');