Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / HTML, CSS, Scripts / HTML / July 2008



Tip: Looking for answers? Try searching our database.

Redirecting double-slash ("//") URLs to single-slash ("/") URLs

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Guy Macon - 03 Jul 2008 23:42 GMT
As a personal learning experience with limited practical use,
I have been doing some experiments with using .htaccess to
redirect mis-typed URLs to a preferred canonical form.  I have
set up a test page at [ http://www.guymacon.org/test.html ]
to show the results of my testing.

Most of the URLs redirect as I want them to do, but the three
URLS (with "//" instead of "/") in bold  do not redirect.

I have searched the web and have not found a single website
that redirects *all* "//" URLs to "/" URLs.

Given the rarity of this error, a solution that causes a 404
error rather than a 301 redirect would be fine with me, but I
haven't seen any websites that manage that one either.

Any suggestions for things to try would be most welcome.
Thanks!

[ http://www.guymacon.org/test.html ]

Signature

Guy Macon
<http://www.GuyMacon.com/>

Steve - 04 Jul 2008 02:13 GMT
> As a personal learning experience with limited practical use,
> I have been doing some experiments with using .htaccess to
[quoted text clipped - 16 lines]
>
> [ http://www.guymacon.org/test.html ]

Haven't tested but this guy's approach looks good on paper if you have
access to PHP (probably easy enough to replicate in any server-side
language):

http://groups.google.com/group/alt.internet.search-engines/msg/9a0f7baad24c74dc

Dunno.  It's a nearly 3-year old thread you were actually involved in,
so perhaps it doesn't work.
Steve - 04 Jul 2008 02:14 GMT
> Dunno.  It's a nearly 3-year old thread you were actually involved in,
> so perhaps it doesn't work.

... and by that, I mean perhaps you already tried it.  Just re-read and
that sentence came off as an insult, which wasn't my intent.
Guy Macon - 04 Jul 2008 10:23 GMT
>Haven't tested but this guy's approach looks good on paper if you have
>access to PHP (probably easy enough to replicate in any server-side
>language):
>
>http://groups.google.com/group/alt.internet.search-engines/msg/9a0f7baad24c74dc

Thanks!

I put it in my .htaccess -- you can see the results by clicking on
the three bold URLs at [ http://www.guymacon.org/test.html ].

Signature

Guy Macon
<http://www.GuyMacon.com/>

Guy Macon - 06 Jul 2008 09:38 GMT
>>Haven't tested but this guy's approach looks good on paper if you have
>>access to PHP (probably easy enough to replicate in any server-side
[quoted text clipped - 6 lines]
>I put it in my .htaccess -- you can see the results by clicking on
>the three bold URLs at [ http://www.guymacon.org/test.html ].

I am now removing it again.  The result was, as I expected, that
It did not handle the test cases in bold at
[ http://www.guymacon.org/test.html ].
As far as I can tell, no website anywhere is able to handle all
of those test cases using .htaccess -- I am convinced that Apache
converts some "//"s to "/"s prior to feeding user request to
mod_rewrite.

Signature

Guy Macon
<http://www.GuyMacon.com/>

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.