Forum Moderators: phranque

Message Too Old, No Replies

Backslashes in URLs

Talk about mistakes in naming a folder...

         

BillyS

1:42 am on Jan 3, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I made the mistake of naming a folder with a backslash in it. Here's what I mean:

www.foo_foo.com/black-/-white/

Which gets translated to:

www.foo_foo.com/black-%10-white/

Well, I have this page in this folder that went supplemental and I'm trying to redirectmatch the thing away using the following combinations, none of which seem to work:

RedirectMatch 410 ^/black-\%10-white/page-now-gone/
RedirectMatch 410 ^/black-%10-white/page-now-gone/
RedirectMatch 410 ^/black-/-white/page-now-gone/
RedirectMatch 410 ^/black-\/-white/page-now-gone/

Unfortunately, 2 hours later I still can't figure out how to do this. Search engines don't like the "%10" so looking for the exact information is proving tough. Any help is deeply appreciated.

jdMorgan

2:10 am on Jan 3, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



A backslash should be encoded as %5c, so I'm not sure what's going on here. %10 is a non-printable DLE (Data Link Escape) character.

You might want to confirm this or rule this out, but you can't catch the error if the code you're looking for isn't correct.

Jim

BillyS

3:26 am on Jan 3, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Jim -

I'm using a CMS (Joomla), which automatically rewrites the URLs for me. I know that I named the folder like this:
/black / white/
And I know the URLs show up as:
/black-%10-white/

I just tried the %5c to see if that would work, but no dice. Is there any other way to try and kill this page? Right now, I think the system is 301ing it back to the index page (based on header checks).

jdMorgan

3:47 am on Jan 3, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Can you use mod_rewrite on your server?

If so, the 'raw' URL can be tested using one of

RewriteCond %{REQUEST_URI} ^/black-\%10-white/page-now-gone/

or
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /black-\%10-white/page-now-gone/

so that you can 'find' the %10 sequence, and then follow that up with

RewriteRule ^black.+white/page-now-gone/ - [G]

to produce a 410-Gone response.

(The extra step of using RewriteCond is required because the URL seen by RewriteRule is the localized and decoded URL, so the %10 won't be testable in RewriteRule itself.)

Jim

BillyS

11:34 pm on Jan 3, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Jim -

This combination worked:

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /black-\%10-white/page-now-gone/
RewriteRule ^black.+white/page-now-gone/ - [G]

Man, you are good at this!

Thank you very much. This was the last supplemental result in Google that I couldn't figure out how to address.

Bill