Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ginnw2/ad90947d411ccfcc76bbaae2bcca54de to your computer and use it in GitHub Desktop.
Save Ginnw2/ad90947d411ccfcc76bbaae2bcca54de to your computer and use it in GitHub Desktop.
Убираем страницы с адресом http://site.site/element_code/random с учетом GET параметров
<?
//удалаем GET
$url = explode('?', $_SERVER['REQUEST_URI']);
//получаем ссылку без GET
$url = $url[0];
//преобразовываем в массив
$pieces = explode("/", $url);
$new_array = array_diff($pieces, array(''));
//проверяем соответствие кода элемента и последнего элемента массива
if(end($new_array)!=$_REQUEST["ELEMENT_CODE"])
LocalRedirect("/404.php", "404 Not Found");
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment