sbrbot
sbrbot

Reputation: 6447

Wrong file include on IIS

I've got the following directory-file structure;

/index.php
/head.inc    (upper)
/subdir/page.php
/subdir/head.inc   (lower)

In /subdir/page.php I have a redirection to upper level index.php

header("location: ../index.php");

In index.php file there's include('head.inc') directive.

On Apache server correct head.inc (upper) is loaded - head.inc from the same (webroot) directory where index.php resides. On IIS the incorrect head.inc (lower) is loaded - head.inc from /subdir/ where page.php resides which made a redirection! Is this a bug in ISS?

Upvotes: 0

Views: 201

Answers (1)

Zar
Zar

Reputation: 6882

Try generating your own, full path. Examples of this might be:

// Get the parent directory
$parent_directory = basename(dirname(dirname(__FILE__)));

header("Location: $parent_directory/index.php");

Upvotes: 1

Related Questions