Quantcast
Channel: SE Stuff and the like... » security
Viewing all articles
Browse latest Browse all 2

Shared : Always redirect to root script.

0
0

This script is intended to redirect people back to the root application when manually browsing to hidden application folders. i.e.
/inc/ should never show an index, so we install an index.html / index.php. This script will redirect people back to ./ no matter what the path.

<?php
// No matter where you are, always redirect back to root
$r = '';
$d = (count(explode('/', dirname($_SERVER['SCRIPT_NAME']))) -1);
for($l = 1; $l <= $d; $l++){$r .= '../';}
header('location:'.$r);
?>

Tagged: any, application, back, Count, directory, dirs, from, good, include, levels, path, PHP, redirect, root, secure, security, Server, The, to, Using, way, Web, within

Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images