<?php if($_SERVER['document_url']=='/index.php' && empty($_SERVER['QUERY_STRING'])){ }else{ echo '<button type="button" class="btn btn-link" onclick="history.back()"><i class="glyphicon glyphicon-arrow-left"></i><span>Назад</span></button>';}?>
//echo '<pre>';print_r($_SERVER);echo '</pre>';
if((empty($_SERVER['DOCUMENT_URI']) || $_SERVER['DOCUMENT_URI']=='/index.php')&&
empty($_SERVER['QUERY_STRING'])){
}else{
echo '<button type="button" class="btn btn-link" onclick="history.back()">
<i class="glyphicon glyphicon-arrow-left"></i><span>Назад</span></button>';
}