IIRF doesn't seem to work

Topics: User Forum
Oct 23, 2006 at 2:52 AM
Hi,

I recently installed IIRF and am trying a couple of samples however it does not seem to work. Below is what I have in my IsapiRewrite4.ini file. I'm am wanting to have any incoming HTML/HTM file to be written as *.asp e.g. Also how would I rewrite the URL http://127.0.0.1/test/index.asp?CatID=1&ProductID=2 to http://127.0.0.1/test/1/2

Incoming URL
http://127.0.0.1/test/index.html

Rewritten URL - What it should look like
http://127.0.0.1/test/index.asp

RewriteLog D:\Data\Temp\iirfLog.out
RewriteLogLevel 5
IterationLimit 10
RewriteRule ^/(^/\.+)\.(html|html)(.*)$ /$1.asp$3

This is what is returned in the log file.

Mon Oct 23 15:43:21 2006 - Read .ini file: setting LogLevel to 5
Mon Oct 23 15:43:21 2006 - Read .ini file: Iteration Limit= 10
Mon Oct 23 15:43:21 2006 - ini line 18: RewriteRule 1 ^/(^/\.+)\.(html|htm)(.*)$ /$1.aspx$3 (null)
Mon Oct 23 15:43:21 2006 - not a duplicate rule...
Mon Oct 23 15:43:21 2006 - Done reading .ini file: Found 1 rules (0 failed) on 20 lines
Mon Oct 23 15:43:21 2006 - Ionic URL Rewriting ISAPI Filter v1.2.10
Mon Oct 23 15:43:21 2006 - Initialize, main threadId= 2464
Mon Oct 23 15:43:21 2006 - File watcher thread created.
Mon Oct 23 15:43:21 2006 - GetFilterVersion
Mon Oct 23 15:43:21 2006 - FileChangeWatcher(): Enter, threadId=1544...
Mon Oct 23 15:43:21 2006 - FileChangeWatcher: Await()...
Mon Oct 23 15:43:21 2006 - AwaitIniChangeAndReinit()...
Mon Oct 23 15:43:21 2006 - DllMain THREAD_DETACH, threadId= 3132
Mon Oct 23 15:43:52 2006 - DllMain THREAD_DETACH, threadId= 1100
Mon Oct 23 15:44:06 2006 - watcher got something...
Mon Oct 23 15:44:06 2006 - Detected change in file 'IsapiRewrite4.ini'
Mon Oct 23 15:44:06 2006 - Detected change in the ini file. . .
Mon Oct 23 15:44:06 2006 - Ionic URL Rewriting ISAPI Filter v1.2.10
Mon Oct 23 15:44:06 2006 - ReadConfig
Mon Oct 23 15:44:06 2006 - LogFile re-opened.
Mon Oct 23 15:44:06 2006 - Read .ini file: new log file name: D:\Data\Temp\iirfLog.out.2116.log
Mon Oct 23 15:44:06 2006 - Read .ini file: setting LogLevel to 5
Mon Oct 23 15:44:06 2006 - Read .ini file: Iteration Limit= 10
Mon Oct 23 15:44:06 2006 - ini line 18: RewriteRule 1 ^/(^/\.+)\.(html|htm)(.*)$ /$1.asp$3 (null)
Mon Oct 23 15:44:06 2006 - not a duplicate rule...
Mon Oct 23 15:44:06 2006 - Done reading .ini file: Found 1 rules (0 failed) on 20 lines
Oct 24, 2006 at 1:48 AM
Thanks



Oct 25, 2006 at 5:28 AM
Can someone please help?
Coordinator
Oct 26, 2006 at 11:31 PM
Michelle,
it appears that IIRF is not being notified of ANY incoming URLs.

With each URL processed, you should see a log line like:

Thu Oct 05 16:51:18 2006 - New Url: '/something/here.htm'


But your log file shows no such thing?

Somehow your IIRF is not being notified of any incoming requests. Are you sure you are tickling the correct web server with your browser? Maybe check the IIS log to verify that it is handling the requests you think it should be handling.


you can also run the testdriver to test your rules.

-Cheeso
Oct 30, 2006 at 2:36 AM
Thanks Cheeso. I didn't understand what you meant by 'Somehow your IIRF is not being notified of any incoming requests. Are you sure you are tickling the correct web server with your browser? Maybe check the IIS log to verify that it is handling the requests you think it should be handling.'?

How can I ensure that IIRF is notified of any incoming requests?
Oct 30, 2006 at 3:08 AM
Cheeso,

I reinstalled the ISAPI filter and it does now show the New URL line in the logs (below) however it does not still rewrite the URL as per the ini (below) file. Please help as I need to urgently get it working. Thanks

'INI
  1. IsapiRewrite4.ini
#
  1. ini file for the ISAPI rewriter.
#
  1. An Example for doing translation of JSP to ASPX. This is useful
  2. when doing a staged migration of a website, moving from JSP to
  3. ASP.NET. Similar approach could work with ASP, PHP or other
  4. server-side scripting languages.
#
  1. Mon, 01 May 2006 09:01
#

RewriteLog D:\Data\Temp\iirfLog.out
RewriteLogLevel 3

IterationLimit 10

RewriteRule ^/(^/\.+)\.(html|htm)(.*)$ /$1.asp$3

'Log
--------------------------------------------
Mon Oct 30 17:03:47 2006 - Read .ini file: setting LogLevel to 3
Mon Oct 30 17:03:47 2006 - Read .ini file: Iteration Limit= 10
Mon Oct 30 17:03:47 2006 - ini line 18: RewriteRule 1 ^/(^/\.+)\.(html|htm)(.*)$ /$1.asp$3 (null)
Mon Oct 30 17:03:47 2006 - Done reading .ini file: Found 1 rules (0 failed) on 20 lines
Mon Oct 30 17:03:47 2006 - Ionic URL Rewriting ISAPI Filter v1.2.10
Mon Oct 30 17:03:47 2006 - Initialize, main threadId= 3784
Mon Oct 30 17:03:47 2006 - File watcher thread created.
Mon Oct 30 17:03:47 2006 - GetFilterVersion
Mon Oct 30 17:03:48 2006 - DllMain THREAD_DETACH, threadId= 2080
Mon Oct 30 17:04:09 2006 - HttpFilterProc SFNOTIFYURL_MAP
Mon Oct 30 17:04:09 2006 - HttpFilterProc SFNOTIFYAUTH_COMPLETE
Mon Oct 30 17:04:09 2006 - DoRewrites
Mon Oct 30 17:04:09 2006 - New Url: '/lcq/index.html'
Mon Oct 30 17:04:09 2006 - ApplyRules (depth=0)
Mon Oct 30 17:04:09 2006 - Rule 1 : -1 (No match)
Mon Oct 30 17:04:09 2006 - ApplyRules: returning 0
Mon Oct 30 17:04:09 2006 - No Rewrite
Mon Oct 30 17:04:09 2006 - HttpFilterProc SFNOTIFYURL_MAP
Mon Oct 30 17:04:09 2006 - HttpFilterProc SFNOTIFYAUTH_COMPLETE
Mon Oct 30 17:04:09 2006 - DoRewrites
Mon Oct 30 17:04:09 2006 - New Url: '/lcq/images/HMC.gif'
Mon Oct 30 17:04:09 2006 - ApplyRules (depth=0)
Mon Oct 30 17:04:09 2006 - Rule 1 : -1 (No match)
Mon Oct 30 17:04:09 2006 - ApplyRules: returning 0
Mon Oct 30 17:04:09 2006 - No Rewrite
Mon Oct 30 17:04:09 2006 - HttpFilterProc SFNOTIFYURL_MAP
Mon Oct 30 17:04:09 2006 - HttpFilterProc SFNOTIFYAUTH_COMPLETE
Mon Oct 30 17:04:09 2006 - DoRewrites
Mon Oct 30 17:04:09 2006 - New Url: '/lcq/images/bg.gif'
Mon Oct 30 17:04:09 2006 - ApplyRules (depth=0)
Mon Oct 30 17:04:09 2006 - Rule 1 : -1 (No match)
Oct 30, 2006 at 3:21 AM
I also tried it with the basic regex example of RewriteRule ^/$ test.asp. The request log is below and it still did not work.


--------------------------------------------
Mon Oct 30 17:21:17 2006 - LogFile re-opened.
Mon Oct 30 17:21:39 2006 - HttpFilterProc SFNOTIFYURL_MAP
Mon Oct 30 17:21:39 2006 - HttpFilterProc SFNOTIFYAUTH_COMPLETE
Mon Oct 30 17:21:39 2006 - DoRewrites
Mon Oct 30 17:21:39 2006 - New Url: '/Text.htm'
Mon Oct 30 17:21:39 2006 - ApplyRules (depth=0)
Mon Oct 30 17:21:39 2006 - Rule 1 : -1 (No match)
Mon Oct 30 17:21:39 2006 - ApplyRules: returning 0
Mon Oct 30 17:21:39 2006 - No Rewrite
Mon Oct 30 17:21:40 2006 - HttpFilterProc SFNOTIFYURL_MAP
Mon Oct 30 17:21:40 2006 - HttpFilterProc SFNOTIFYAUTH_COMPLETE
Mon Oct 30 17:21:40 2006 - DoRewrites
Mon Oct 30 17:21:40 2006 - New Url: '/Text.htm.htm'
Mon Oct 30 17:21:40 2006 - ApplyRules (depth=0)
Mon Oct 30 17:21:40 2006 - Rule 1 : -1 (No match)
Mon Oct 30 17:21:40 2006 - ApplyRules: returning 0
Mon Oct 30 17:21:40 2006 - No Rewrite
Oct 30, 2006 at 8:44 PM
one issue is that you are using "test.htm" but your rule is for "*.htmL"...
Oct 30, 2006 at 8:46 PM
Maybe try:
RewriteRule ^(.+)\.(html)(.*)$ $1.asp$3
Oct 30, 2006 at 8:49 PM
in fact.. i would add an L so it is not recursive...

RewriteRule ^(.+)\.(html)(.*)$ $1.asp$3 L
Oct 30, 2006 at 8:51 PM
yeee... the preceding 'L'-modifier needs to be surrounded by square brackets... these are being parsed by the blog...

escape experiment... [L]
Oct 31, 2006 at 2:09 AM
davez,

Thanks for that. I updated the sample you suggested and now the issue I face is that the browser returns the error that the page (Test.html) can't be found. The file is definitely there. Here is the log from IIRF. I can see that it has attempted to rewrite it to Test.asp which is great but the browser does not display the page with the rewritten URL in the address bar. Thanks for your help.

'Log
Tue Oct 31 16:06:55 2006 - ApplyRules: returning 0
Tue Oct 31 16:06:55 2006 - No Rewrite
Tue Oct 31 16:07:06 2006 - HttpFilterProc SFNOTIFYURL_MAP
Tue Oct 31 16:07:06 2006 - HttpFilterProc SFNOTIFYAUTH_COMPLETE
Tue Oct 31 16:07:06 2006 - DoRewrites
Tue Oct 31 16:07:06 2006 - New Url: '/Test.html'
Tue Oct 31 16:07:06 2006 - ApplyRules (depth=0)
Tue Oct 31 16:07:06 2006 - Rule 1 : 4 matches
Tue Oct 31 16:07:06 2006 - Result (length 9): /Test.asp
Tue Oct 31 16:07:06 2006 - Last if Match
Tue Oct 31 16:07:06 2006 - ApplyRules: returning 1
Tue Oct 31 16:07:06 2006 - Rewrite Url to: '/Test.asp'
Tue Oct 31 16:07:06 2006 - HttpFilterProc SFNOTIFYURL_MAP
Tue Oct 31 16:07:06 2006 - HttpFilterProc SFNOTIFYURL_MAP
Oct 31, 2006 at 4:20 AM
if you want to change the browser's url being displayed to match the server's real underlying *.asp one, then you need to do a redirect. try adding the '[R]' modifier. it's not as efficient, and doesn't buy you much in this case, since your *.html will consistently translate.

if you were playing other games to unconditionally maintain friendly urls (which is not reflected in the thread) then you might gain something by the redirect.
Oct 31, 2006 at 4:25 AM
davez,

Thanks for that. I don't quite follow what you meant. Isn't the ISAPI filter meant to 'rewrite' the way the URL appears e.g. to display test.html as test.asp. The underlying file in this example obviously remains as *.html but is simply displayed as *.asp. What does the 'R' do exactly? I don't want to redirect it as there isn't a test.asp file. All I want to do is display the URL as test.asp using the file test.html.
Oct 31, 2006 at 4:29 AM
davez,

I did attempt to use 'R' (which I suspect is simply a redirect), the browser still displays the error that the page is not found. Here is the log from IIRF.

'Log
Tue Oct 31 18:29:15 2006 - Read .ini file: setting LogLevel to 3
Tue Oct 31 18:29:15 2006 - Read .ini file: Iteration Limit= 10
Tue Oct 31 18:29:15 2006 - ini line 21: RewriteRule 1 ^(.+)\.(html)(.*)$ $1.asp$3R (null)
Tue Oct 31 18:29:15 2006 - Done reading .ini file: Found 1 rules (0 failed) on 23 lines
Tue Oct 31 18:29:15 2006 - Ionic URL Rewriting ISAPI Filter v1.2.10
Tue Oct 31 18:29:15 2006 - Initialize, main threadId= 2784
Tue Oct 31 18:29:15 2006 - File watcher thread created.
Tue Oct 31 18:29:15 2006 - GetFilterVersion
Tue Oct 31 18:29:17 2006 - DllMain THREAD_DETACH, threadId= 1420
Tue Oct 31 18:29:38 2006 - HttpFilterProc SFNOTIFYURL_MAP
Tue Oct 31 18:29:38 2006 - HttpFilterProc SFNOTIFYAUTH_COMPLETE
Tue Oct 31 18:29:38 2006 - DoRewrites
Tue Oct 31 18:29:38 2006 - New Url: '/Test.html'
Tue Oct 31 18:29:38 2006 - ApplyRules (depth=0)
Tue Oct 31 18:29:38 2006 - Rule 1 : 4 matches
Tue Oct 31 18:29:38 2006 - Result (length 12): /Test.aspR
Tue Oct 31 18:29:38 2006 - ApplyRules (depth=1)
Tue Oct 31 18:29:38 2006 - Rule 1 : -1 (No match)
Tue Oct 31 18:29:38 2006 - ApplyRules: returning 0
Tue Oct 31 18:29:38 2006 - ApplyRules: returning 1
Tue Oct 31 18:29:38 2006 - Rewrite Url to: '/Test.aspR'
Tue Oct 31 18:29:38 2006 - HttpFilterProc SFNOTIFYURL_MAP
Tue Oct 31 18:29:46 2006 - DllMain THREAD_DETACH, threadId= 2812
Coordinator
Oct 31, 2006 at 7:55 PM
Michellea,
Can you tell us again, what are you trying to accomplish ?
I'm sorry for being obtuse, but sometimes people need to explain things to me several times. in small words. slowly.

something like this;
"I want, when a user types test.htm into the browser, the server should activate page test.asp, while the browser url bar should remain test.htm."

If it is test.html, then so be it.

And, in addition to what you want, tell us what you actually get. When you type in test.htm in the browser, what do you get?
Also, if you want the rewrite to resolve to test.asp, what happens if you type test.asp in the browser URL address bar?

-C

Oct 31, 2006 at 8:36 PM
Cheeso,

What I am trying accomplish is that for example if a user types in www.sample.com/test.html in the URL it is displayed as www.sample.com/test.asp or www.sample2.com/test.asp.
Coordinator
Oct 31, 2006 at 9:44 PM
> if a user types in www.sample.com/test.html in the URL it is displayed as www.sample.com/test.asp or www.sample2.com/test.asp.

I still don't get it.
Do you mean

a. if a user types in www.sample.com/test.html in the URL, then "test.asp" should appear in the URL address bar?

b. if a user types in www.sample.com/test.html in the URL bar, the server-side module called "test.asp" should run, and the results display in the browser, while the test.html address is still in the browser address bar?

c. something else?

thanks
-C
Oct 31, 2006 at 9:50 PM
Cheeso,

Sorry. What I mean exactly is that for example:

1) There is a request made for www.sample.com/test.html.
2) The user instead sees www.sample.com/test.asp in the address bar
3) So every HTML page is displayed as *.asp rather than *.html
4) Also I want to be able to display www.abc.com/test.asp if needed
Oct 31, 2006 at 11:02 PM
rewriterule (.*)\.html$ $1\.asp I,L
Oct 31, 2006 at 11:10 PM
ComputerGuru,

Thanks for that however they did not work. The browser returns the error page not found. I have included the output from the log. I must reiterate that there is no such file test.asp. All I want to do is rewrite the URL so that test.html appears as test.asp in the address bar.

'Log
Wed Nov 01 13:09:34 2006 - LogFile re-opened.
Wed Nov 01 13:09:50 2006 - HttpFilterProc SFNOTIFYURL_MAP
Wed Nov 01 13:09:50 2006 - HttpFilterProc SFNOTIFYAUTH_COMPLETE
Wed Nov 01 13:09:50 2006 - DoRewrites
Wed Nov 01 13:09:50 2006 - New Url: '/Test.html'
Wed Nov 01 13:09:50 2006 - ApplyRules (depth=0)
Wed Nov 01 13:09:50 2006 - Rule 1 : 2 matches
Wed Nov 01 13:09:50 2006 - Result (length 9): /Test.asp
Wed Nov 01 13:09:50 2006 - ApplyRules (depth=1)
Wed Nov 01 13:09:50 2006 - Rule 1 : -1 (No match)
Wed Nov 01 13:09:50 2006 - ApplyRules: returning 0
Wed Nov 01 13:09:50 2006 - ApplyRules: returning 1
Wed Nov 01 13:09:50 2006 - Rewrite Url to: '/Test.asp'
Wed Nov 01 13:09:50 2006 - HttpFilterProc SFNOTIFYURL_MAP
Wed Nov 01 13:09:50 2006 - HttpFilterProc SFNOTIFYURL_MAP
Oct 31, 2006 at 11:13 PM
rewriterule ^/(.*)\.htm$ /$1\.asp R,I
rewriterule ^/(.*)\.html$ /$1\.aspx R,I
RewriteCond %{REQUEST_FILENAME} !-f
rewriterule ^/(.*)\.asp$ /$1\.htm I,L
RewriteCond %{REQUEST_FILENAME} !-f
rewriterule ^/(.*)\.aspx$ /$1\.html I,L

the !-f bit is to check whether it is an actual asp file or not.
you MUST differentiate between Html and htm files by setting the extension to a different thing for each (i.e. not asp for both. you must use two different extensions.

No, that's not true. By using the U flag it is possible. You would have it check what the original filename was and stuff first. I am not familiar with the U flag though. Dino?
Oct 31, 2006 at 11:16 PM
Oh yeah, the !-f and U flags are only available in .10 and up - the old stable .4 won't work.
Oct 31, 2006 at 11:19 PM
ComputerGuru,

Thanks for that. Would I need to place the I, L flags between square brackets e.g. "I"?
Oct 31, 2006 at 11:21 PM
codeplex is totally screwed up. so much for a CODEplex about CODE that mangles any CODE you write.

anything that appears underlined is between brackets.
anything that appears italic is between a pair of underscores.

i recommend you don't use the rewritecond lines at the moment- you only need them if you want to serve actual ASP files and ATM the -f stuff isn't working properly in IIRF.
Oct 31, 2006 at 11:22 PM
ComputerGuru,

I still get the error page not found. Below is the output from the log file. I am using version 1.2.10 since I missed that in my last post.

Wed Nov 01 13:22:46 2006 - LogFile re-opened.
Wed Nov 01 13:23:07 2006 - HttpFilterProc SFNOTIFYURL_MAP
Wed Nov 01 13:23:07 2006 - HttpFilterProc SFNOTIFYAUTH_COMPLETE
Wed Nov 01 13:23:07 2006 - DoRewrites
Wed Nov 01 13:23:07 2006 - New Url: '/Test.html'
Wed Nov 01 13:23:07 2006 - ApplyRules (depth=0)
Wed Nov 01 13:23:07 2006 - Rule 1 : -1 (No match)
Wed Nov 01 13:23:07 2006 - Rule 2 : 2 matches
Wed Nov 01 13:23:07 2006 - Result (length 11): /Test\.aspx
Wed Nov 01 13:23:07 2006 - ApplyRules (depth=1)
Wed Nov 01 13:23:07 2006 - Rule 1 : -1 (No match)
Wed Nov 01 13:23:07 2006 - Rule 2 : -1 (No match)
Wed Nov 01 13:23:07 2006 - Rule 3 : -1 (No match)
Wed Nov 01 13:23:07 2006 - Rule 4 : 2 matches
Wed Nov 01 13:23:07 2006 - EvaluateCondition: checking 'D:\Inetpub\wwwroot\Test.html' against pattern '!-f'
Wed Nov 01 13:23:07 2006 - EvaluateCondition: cond->SpecialConditionType= 'f'
Wed Nov 01 13:23:07 2006 - EvaluateConditionList: FALSE, Rule does not apply
Wed Nov 01 13:23:07 2006 - ApplyRules: returning 0
Wed Nov 01 13:23:07 2006 - ApplyRules: returning 1
Wed Nov 01 13:23:07 2006 - Rewrite Url to: '/Test\.aspx'
Wed Nov 01 13:23:07 2006 - HttpFilterProc SFNOTIFYURL_MAP
Oct 31, 2006 at 11:24 PM
ComputerGuru,

Do I place the flags in a single bracket or as independent brackets?
Coordinator
Oct 31, 2006 at 11:25 PM
Michellea,
item #2 in your list above sounds like a redirect.

if you want the browser address bar to switch to "test.asp" if the user types in "test.html" or "test.htm", then that implies a redirect.
essentially the HTTP protocol allows the server to say to the browser - "hey, that resource you requested (test.htm), it moved! the new location is test.asp. if you want it, you should ask for it."

and then the browse automatically follows HTTP 302 redirects, and updates its address bar to say "test.asp" (or whatever the new address is) and then automatcially requests that new resources.

To do this in IIRF, you use a RewriteRule with the R flag (in square brackets).

It is up to you, as the IIRF configuration person, to insure that the test.asp that the browser is redirected TO, actually exists. To be clear, if you redirect to test.asp, then test.asp must exist on your server. Else, the browser requests test.asp, and gets a "404 not found" error. And I think this is what ComputerGuru was trying to get at.

But I don;t quite understand your item #3, "every HTML is displayed as .asp" Do you mean, every request for an .html page is rewritten (redirected) to a request for the corresponding .asp page? If so, that should work.

if you want to actually display in the browser content window, a static HTML file, and yet you want the browser address bar to hold "test.asp", then that is something different and I don't think IIRF will help you there.

I'm sorry I seem to be so dense, sometimes it is hard to understand just what is going on.

-C

Oct 31, 2006 at 11:26 PM
I placed them in a single bracket and here's the output from the log. Not sure why the URL appears returns:

New Url: '/Test/.aspx' rather than Test.asp or Test.aspx

'Log
Wed Nov 01 13:27:04 2006 - LogFile re-opened.
Wed Nov 01 13:27:16 2006 - HttpFilterProc SFNOTIFYURL_MAP
Wed Nov 01 13:27:16 2006 - HttpFilterProc SFNOTIFYAUTH_COMPLETE
Wed Nov 01 13:27:16 2006 - DoRewrites
Wed Nov 01 13:27:16 2006 - New Url: '/Test.html'
Wed Nov 01 13:27:16 2006 - ApplyRules (depth=0)
Wed Nov 01 13:27:16 2006 - Rule 1 : -1 (No match)
Wed Nov 01 13:27:16 2006 - Rule 2 : 2 matches
Wed Nov 01 13:27:16 2006 - Result (length 11): /Test\.aspx
Wed Nov 01 13:27:16 2006 - ApplyRules: returning 302
Wed Nov 01 13:27:16 2006 - Redirect (code=302) Url to: '/Test\.aspx'
Wed Nov 01 13:27:16 2006 - HttpFilterProc SFNOTIFYURL_MAP
Wed Nov 01 13:27:16 2006 - HttpFilterProc SFNOTIFYAUTH_COMPLETE
Wed Nov 01 13:27:16 2006 - DoRewrites
Wed Nov 01 13:27:16 2006 - New Url: '/Test/.aspx'
Wed Nov 01 13:27:16 2006 - ApplyRules (depth=0)
Wed Nov 01 13:27:16 2006 - Rule 1 : -1 (No match)
Wed Nov 01 13:27:16 2006 - Rule 2 : -1 (No match)
Wed Nov 01 13:27:16 2006 - Rule 3 : -1 (No match)
Wed Nov 01 13:27:16 2006 - Rule 4 : 2 matches
Wed Nov 01 13:27:16 2006 - EvaluateCondition: checking 'D:\Inetpub\wwwroot\Test\.aspx' against pattern '!-f'
Wed Nov 01 13:27:16 2006 - EvaluateCondition: cond->SpecialConditionType= 'f'
Wed Nov 01 13:27:16 2006 - EvaluateConditionList: TRUE, Rule will apply
Wed Nov 01 13:27:16 2006 - Result (length 12): /Test/\.html
Wed Nov 01 13:27:16 2006 - Last if Match
Wed Nov 01 13:27:16 2006 - ApplyRules: returning 1
Wed Nov 01 13:27:16 2006 - Rewrite Url to: '/Test/\.html'
Wed Nov 01 13:27:16 2006 - HttpFilterProc SFNOTIFYURL_MAP
Oct 31, 2006 at 11:30 PM
Cheeso,

Sorry I think I might have not been clear. Hopefully this might help. I apologise for not being clearer.

1) I have a file called Test.html. There is no file called Test.asp or Test.aspx
2) I (the user) request the page e.g. 127.0.0.1/Test.html or www.sample.com/Test.html
3) Now rather than display 127.0.0.1/Test.html or www.sample.com/Test.html in the address bar, I want them to appear as 127.0.0.1/Test.asp or www.sample.com/Test.asp
4) I also want to be able to display them as 0.0.0.0/Test.html or www.abc.com/Test.html
5) I am wanting to completely rewrite the way the URL appears to the end user.
Oct 31, 2006 at 11:32 PM
rewriterule ^/(.*)\.htm$ /$1.asp R,I
rewriterule ^/(.*)\.html$ /$1.aspx R,I
RewriteCond %{REQUEST_FILENAME} !-f
rewriterule ^/(.*)\.asp$ /$1.htm I,L
RewriteCond %{REQUEST_FILENAME} !-f
rewriterule ^/(.*)\.aspx$ /$1.html I,L
Oct 31, 2006 at 11:40 PM
ComputerGuru,

Thank you, Thank you, Thank you. That worked!!!. I can't thank you enough. Now a couple more questions.

1) Why does it rewrite to *.aspx and not *.asp?
2) How can expand the rules so that it can go work for a directory of any depth e.g. /directory1/Test.html or /directory1/directory2/Test.html or /directory1/directory2/directory3/directory4/Test.html
3) Rewrite it so that if it ends with a querystring e.g. www.sample.com/test.asp?ID=1. It rewrites the URL to www.abc.com/test.asp
Oct 31, 2006 at 11:41 PM
Sorry, I am not sure why it reposted so many times.
Oct 31, 2006 at 11:45 PM
ComputerGuru,

Please disregard my query about why it displays as *.aspx and not *.asp. I didn't notice the rule that to rewrite *.htm files as *.asp and *.html files as *.aspx.
Oct 31, 2006 at 11:47 PM
ComputerGuru,

I didn't qute follow what you meant by your comment earlier 'i recommend you don't use the rewritecond lines at the moment- you only need them if you want to serve actual ASP files and ATM the -f stuff isn't working properly in IIRF.'
Nov 1, 2006 at 3:33 PM
Read the other thread "possible issue"
Nov 2, 2006 at 12:23 AM
ComputerGuru,

Thanks for that. I couldn't see in the thread which explained how I could do the following:

1) How can expand the rules so that it can go work for a directory of any depth e.g. /directory1/Test.html or /directory1/directory2/Test.html or /directory1/directory2/directory3/directory4/Test.html


2) Rewrite it so that if it ends with a querystring e.g. www.sample.com/test.asp?ID=1. It rewrites the URL to www.abc.com/test.asp?ID=1
Nov 2, 2006 at 9:13 PM
Thank you.
Nov 3, 2006 at 1:00 AM
I'm not sure how to achieve the following. I don't mean to repost but I urgently need help.

1) How can expand the rules so that it can go work for a directory of any depth e.g. /directory1/Test.html or /directory1/directory2/Test.html or /directory1/directory2/directory3/directory4/Test.html


2) Rewrite it so that if it ends with a querystring e.g. www.sample.com/test.asp?ID=1. It rewrites the URL to www.abc.com/test.asp?ID=1

Nov 3, 2006 at 3:01 PM
What are you realy trying to accomplish ??

Looks like you want to create static .html pages, and make it appear as they where .asp pages ??
Nov 3, 2006 at 8:33 PM
What I am trying to accomplish is regardless if it is a static HTML page or server-side page e.g. ASP, ASPX, etc

1) How can expand the rules so that it can go work for a directory of any depth e.g. /directory1/Test.html or /directory1/directory2/Test.html or /directory1/directory2/directory3/directory4/Test.html


2) Rewrite it so that if it ends with a querystring e.g. www.sample.com/test.asp?ID=1. It rewrites the URL to www.abc.com/test.asp?ID=1

Nov 5, 2006 at 7:21 AM
I was wondering how I could do the following expand on the query below to accommodate the following:

1) If a user types in www.sample.com/test.asp?ID=1 or www.sample.com/test.asp?ID=1&CID=2, etc the URL is rewritten to www.test.com or www.test.com/1 or www.test.com/1/2

This is an existing condition

RewriteRule ^/(.*)\.htm$ /$1.asp R,I
RewriteRule ^/(.*)\.html$ /$1.aspx R,I
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/(.*)\.asp$ /$1.htm I,L
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/(.*)\.aspx$ /$1.html I,L
Nov 5, 2006 at 8:33 PM
Can anyone please help? I'm at my wits end.
Nov 5, 2006 at 10:39 PM
RewriteRule ^localhost$ ^127.0.0.1$ R,I
RewriteCond %{HTTP_HOST} ^localhost$ I
RewriteRule ^127.0.0.1$ ^localhost$ I,L

RewriteRule ^/(.*)\.htm$ /$1.asp R,I
RewriteRule ^/(.*)\.html$ /$1.aspx R,I
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/(.*)\.asp$ /$1.htm I,L
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/(.*)\.aspx$ /$1.html I,L
Nov 6, 2006 at 1:28 AM
Michellea, you said:

"1) If a user types in www.sample.com/test.asp?ID=1 or www.sample.com/test.asp?ID=1&CID=2, etc the URL is rewritten to www.test.com or www.test.com/1 or www.test.com/1/2"

To change the domain in your browser's address bar like that, you have to physically redirect (i.e. get the browser to request a page from that domain). If you were able to change the domain name to anything you wanted and still get your own server to serve the resulting page, that would be a huge security risk for end users. If you own both domain names, redirecting shouldn't be a big deal, but that would mean the redirect rules would have to be in place for one server, and any actual back end URL rewriting would need to happen on the server you redirect to.
Nov 6, 2006 at 1:32 AM
ComputerGuru, is there a reason you used this:

rewriterule ^/(.*)\.htm$ /$1.asp R,I
rewriterule ^/(.*)\.html$ /$1.aspx R,I

...instead of a single rule with an optional "l" at the end of the extension (\.html?).

Just curious if I'm missing something and if the ".aspx" rule is actually needed.
Nov 6, 2006 at 1:39 AM
SteveAtFAA,

I do own both domains. I didn't quite follow what you meant by "you own both domain names, redirecting shouldn't be a big deal, but that would mean the redirect rules would have to be in place for one server, and any actual back end URL rewriting would need to happen on the server you redirect to." Do you have an example of what you mean?
Nov 7, 2006 at 9:05 AM
Thank you.
Nov 20, 2006 at 6:31 PM
Anyone at all? I really appreciate any help.