View Single Post
  #3  
Old 03-30-2011, 05:29 AM
jack jack is offline
New Member
 
Join Date: Mar 2011
Posts: 7
I had noticed that, sometimes, the url in the address bar got 'cleaned' from double slashes (with no rewrite rules at all). However, I haven't been able to reproduce this behaviour for a while -- it might have happened in another server.

Of course, that doesn't meen that LiteSpeed isn't cleaning them, it's just not issuing redirects, so the browser doesn't know of this.

To check this I wrote this php script (as index.php):
<?php echo 'REQUEST_URI = ' . $_SERVER['REQUEST_URI']; ?>

and when requesting these urls, i get:

http://my.domain/a//index.php --- REQUEST_URI = /a//index.php
http://my.domain/a/b/index.php --- REQUEST_URI = /a/b/index.php
http://my.domain/a/b --- REQUEST_URI = /a/b/
http://my.domain/a//b --- REQUEST_URI = /a//b/

It looks like LiteSpeed is passing the original REQUEST_URI to PHP, and not the filtered one.

I then went back to fiddle with .htaccess.

To be sure the RewriteRule was being satisfied, I tried a more obvious Cond:

RewriteCond &#37;{ORG_REQ_URI} ^/a/$
RewriteRule .* http://example.com [R=301,L]

and it works! I get redirected when visiting http://my.domain/a/ (or /a because the server automatically always adds the last slash), as expected. But it doesn't redirect with my original condition.

My conclusion is that this condition isn't being matched:
RewriteCond %{ORG_REQ_URI} ^(.*)//(.*)/$

Any ideas of how can I sort this out?

I have a client getting 404s in urls with double slashes and wish to sort that out. He's using Magento.

Last edited by jack; 03-30-2011 at 05:30 AM.. Reason: Typo...
Reply With Quote