Skip to content

Instantly share code, notes, and snippets.

@Langmans
Created March 17, 2016 11:00
Show Gist options
  • Select an option

  • Save Langmans/76853e0ccaf37254439e to your computer and use it in GitHub Desktop.

Select an option

Save Langmans/76853e0ccaf37254439e to your computer and use it in GitHub Desktop.
get requested url when rewriteengine is on.
<?php
$url = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
$base = rtrim(str_replace('\\', '/', dirname($_SERVER['SCRIPT_NAME'])), '/');
$len = strlen($base);
if (substr($url, 0, $len) == $base) {
$url = substr($url, $len);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment