You are here

function trailing_slash_boot in Trailing Slash 7

Implements hook_boot().

Cleanup $_GET['q'] on bootstrap.

Some modules might not cater for URLs that end in a trailing slash and might accidentally concatenate two or more slashes together in a URL path. This replaces any occurences of multiple slashes in $_GET['q'] with only one so that such URLs are still routed by Drupal properly.

File

./trailing_slash.module, line 103
Adds checkbox to the Clean URLs settings form and alters outbound URLs.

Code

function trailing_slash_boot() {
  $_GET['q'] = preg_replace('/\\/{2,}/', '/', $_GET['q']);
}