hello, trying to understand the rewrite rules

Topics: User Forum
May 17, 2007 at 1:25 AM
Hello I want to rewrite the following URL http://sportdata.com.au/sdp/Sportdata.dll/reqLeagues?CID=343649&SPORTNO=1173331&stats=1

I want to change the ? to any other sysmbol such as / or # and then have it restored to the above, however, I want to allow the numbers to be any numbers. Can somebody please help me write a rewrite rule? Thanks

Mark Horrocks
May 31, 2007 at 9:52 AM
Edited May 31, 2007 at 10:04 AM
This should do the trick.

RewriteRule ^(/sdp/Sportdata.dll/reqLeagues)\?(.*)$ $1#$2 [I,RP]

Explination

^(/sdp/Sportdata.dll/reqLeagues)

Checks that the URL starts with "/sdp/Sportdata.dll/reqLeagues", because it is in braces () this will be $1 in the output URL.

"\?"

looks for the ? (remember ? is a special character so needs to be escaped with \)

"(.*)$"

captures the rest of the url and places it into $2.

You can replace # with any character you like in the output url.
Jun 8, 2007 at 7:02 AM
hi guys
before everything,

do we have to rely on the server's setting for the re-write capability on a shared-hosting server? and, if the server has one installed, how do we know the setting/rule?
Coordinator
Jun 13, 2007 at 12:09 AM
do we have to rely on the server's setting for the re-write capability on a shared-hosting server? and, if the server has one installed, how do we know the setting/rule?

I think what you are asking is, if you are using a shared-hosting server, do you have to rely on a server setting in order to use IIRF? IF that is the question, then the answer is yes. You need the IIS server to be configured with the IIRF ISAPI. This is typically not allowed on a shared-hosting arrangement. Your mileage may vary.

best,
-Cheeso