Forum Moderators: phranque

Message Too Old, No Replies

Can the character "#" (ascii code 35) be expressed in a rewrite rule?

         

goodwill14

6:52 am on Jan 29, 2006 (gmt 0)

10+ Year Member



Hello,

I'm trying to create a Mod_rewrite rule that points

the url "mysite.com/c#" to the folder location "/c/cs/csharp/"

but I don't know the syntax, with the below 3 all failing
(separately):

RewriteRule ^c\#/?$ /c/cs/csharp/ [NC,L]
RewriteRule ^c\%23/?$ /c/cs/csharp/ [NC,L]
RewriteRule ^c\x23/?$ /c/cs/csharp/ [NC,L]

(0x23 is Hex for the ascii character "#")

Sorry if this is a basic question. Any help greatly appreciated.

Dan

extras

1:18 pm on Jan 29, 2006 (gmt 0)

10+ Year Member



As long as you are serving normal browsers, you shouldn't be getting #,
as browsers should be stripping everything after that for jumping within the page.

If it's robot making such requests, you can check what they are sending by looking at the log, and then catch with \# (# or %23 in uri) or \%23 (%2523).

Check with RewriteLog or other debugging method.
[webmasterworld.com...]

Alternative method.
[webmasterworld.com...]

goodwill14

8:37 pm on Jan 29, 2006 (gmt 0)

10+ Year Member



Extras,

Thanks for your helpful response, I'll study the links you provided.

Dan