Philip Ronan
01-01-2006, 16:13
OK, here's the fix I'm using (Apache/PHP). Feel free to comment.
1. Put this in your /.htaccess file:
====================================
RewriteEngine On
RewriteCond %{REQUEST_URI} //+
RewriteRule ^(.*)$ /slashfix.php [L]
2. Create a file called /slashfix.php, containing the following:
================================================== ==============
<?php
$prot = $_SERVER["SERVER_PROTOCOL"];
$host = "http://" . $_SERVER["HTTP_HOST"];
$req = $_SERVER["REQUEST_URI"];
$script = $_SERVER["SCRIPT_NAME"];
$sig = $_SERVER["SERVER_SIGNATURE"];
$newLoc = $host . preg_replace('|//+|', '/', $req);
if ($req == $script) die("Unable to redirect.\r\n");
header("$prot 301 Moved Permanently");
header("Location: $newLoc");
?><HTML>
<HEAD>
<TITLE>Invalid Request URI</TITLE>
</HEAD>
<BODY>
<H1>Invalid Request URI</H1>
<P>The URI you provided contains consecutive forward slashes,
which are not accepted by this website. Please try visiting
<A href="<?php echo $newLoc; ?>"><?php echo $newLoc; ?></A> instead.</P>
<HR>
<?php echo $sig; ?>
</BODY>
</HTML>
--
phil [dot] ronan @ virgin [dot] net
http://vzone.virgin.net/phil.ronan/
1. Put this in your /.htaccess file:
====================================
RewriteEngine On
RewriteCond %{REQUEST_URI} //+
RewriteRule ^(.*)$ /slashfix.php [L]
2. Create a file called /slashfix.php, containing the following:
================================================== ==============
<?php
$prot = $_SERVER["SERVER_PROTOCOL"];
$host = "http://" . $_SERVER["HTTP_HOST"];
$req = $_SERVER["REQUEST_URI"];
$script = $_SERVER["SCRIPT_NAME"];
$sig = $_SERVER["SERVER_SIGNATURE"];
$newLoc = $host . preg_replace('|//+|', '/', $req);
if ($req == $script) die("Unable to redirect.\r\n");
header("$prot 301 Moved Permanently");
header("Location: $newLoc");
?><HTML>
<HEAD>
<TITLE>Invalid Request URI</TITLE>
</HEAD>
<BODY>
<H1>Invalid Request URI</H1>
<P>The URI you provided contains consecutive forward slashes,
which are not accepted by this website. Please try visiting
<A href="<?php echo $newLoc; ?>"><?php echo $newLoc; ?></A> instead.</P>
<HR>
<?php echo $sig; ?>
</BODY>
</HTML>
--
phil [dot] ronan @ virgin [dot] net
http://vzone.virgin.net/phil.ronan/