Ticket #31 (closed enhancement: fixed)

Opened 4 years ago

Last modified 4 years ago

Trouble using 404handler.php to redirect to the correct page under IIS

Reported by: MickeyM
Priority: medium Milestone: 7.1
Component: ExiteCMS Core Version: 7.0
Severity: Fix Keywords: 404handler iis

Description

On a Windows server with IIS used to publish the website, there are some $_SERVER variables not available.
Therefore the page is incorrectly loaded.

Suggestion is that the following code snippet is added to the 404handler.php file:

require_once dirname(__FILE__)."/includes/core_functions.php";

// Check if we use IIS.
if (strpos( $_SERVER["SERVER_SOFTWARE"],"IIS" )) {
	$_SERVER['REDIRECT_URL'] = substr($_SERVER['REQUEST_URI'], strrpos($_SERVER['REQUEST_URI'], '/'), strlen($_SERVER['REQUEST_URI']));
}

Variables are filled as follows:

[REQUEST_URI] => /404handler.php?404; http://dev.deottershetgooi.nl:80/diplomazwemmen.php
[URL] => /404handler.php?404; http://dev.deottershetgooi.nl:80/diplomazwemmen.php

Instead of REQUEST_URI, we can also use URL.

Change History

comment:1 Changed 4 years ago by MickeyM

  • Summary changed from 404handler.php werkt niet goed onder IIS. to Trouble using 404handler.php to redirect to the correct page under IIS

comment:2 Changed 4 years ago by WanWizard

  • Status changed from new to closed
  • Resolution set to fixed

Code to detect IIS added in #1176

Note: See TracTickets for help on using tickets.