How to work with a colon in the URL?

Topics: User Forum
Jun 4, 2009 at 1:23 PM
Edited Jun 4, 2009 at 3:07 PM

Hi,

I am new to URL rewriting so please forgive me if I have got a few things wrong here.

I am trying to use the rewrite filter with IIS and CakePHP.  I've almost got it working correctly.   The problem is CakePHP uses colons in it's address for certain functions and the filter isn't processing any URLs with a colon in it.  How do I get IIRF to process a URL with a colon?

Below is all the information relating to my current setup and problem.  I'm writing this message from work so may have a couple of things wrong with formatiing of the ini file.

I am using a virtual directory for my cake application, (I'll call it cakeapp) under the website www.myweb.com.  I've successfully installed the DLL filter and have it working.  When I enter a cake address of http://www.myweb.com/cakeapp/  the website is displayed correctly.  This is the main URL to the application so doesn't get rewritten.  In order for my application to work I have to rewrite everything after http://www.myweb.com/cakeapp/  and put it add the end of  http://www.myweb.com/cakeapp/index.php?url= .  Compared to the others I have seen, this is a simple rewrite.  To achieve this my IIRF.ini file, which is the only one on the site/server and is in the cakeapp directory (I think), contains the following rules:

  • RewriteRule ^/cakeapp/index.php(.*)$  -  [L]            #this will allow normal list to not be processed
  • RewriteRule ^/cakeapp/css/(.*)$ - [L]                  #I had to put this one in to ensure the CSS files were loaded correctly
  • RewriteRule ^/cakeapp/img/(.*)$ - [L]      #I had to put this one in to ensure the Imagesfiles were loaded correctly
  • RewriteRule ^/cakeapp/(.*)$   /cakeapp/index.php?url=/$1 [L]     #this is the one which does the work.  Rewrites everything else to http://www.myweb.com/cakeapp/index.php?url=

When I enter an address of http://www.myweb.com/cakeapp/records/page this is correctly rewritten to  http://www.myweb.com/cakeapp/index.php?url=/records/page and displays the page correctly and the log file indicates it is being filtered.  However, when I enter the address (or click on a link) to display page 2 of the records (http://www.myweb.com/cakeapp/records/page:2 ) the page fails to load with a 404 error.  When I enter the address http://www.myweb.com/cakeapp/index.php?url=/records/page:2 manually it displayys the page correctly.  Nothing is recorded in the IIRF log when I get the 404 error but the log records the address when I use the index.php? way of requesting the page.  Other features like sorting tables etc which also use colons in the address also display the same 404 error.

Does anyone have any suggestions how I can get around this problem or how to configure IIRF correctly to give me more information to find out why the address isn't working?

Thanks

 

 

 

Coordinator
Jul 6, 2009 at 7:21 PM

I tried this and it worked for me in the ISAPI filter.  I correctly got the rewrite to occur.  (see below)

To troubleshoot this, can I see your IIRF log file?

image of 404 page

Jul 7, 2009 at 3:47 AM
Edited Jul 7, 2009 at 3:58 AM

Cheeso,

Thanks for the information.  The IIRF log doesn't even show the request being made.  IIRF never sees the page request.

The IIS logs show "<Rejected-By-UrlScan>" when the page is requested with colons in it so it seems a different filter is causing the problems (as you suggested). 

Update: Thanks for your help, I removed the line filtering out the colons in urlscan.ini (C:\WINNT\system32\inetsrv\urlscan\urlscan.ini), restarted IIS and it worked.  Thanks again for your help.

Coordinator
Jul 7, 2009 at 4:38 AM

There ya go, I figured that's what it was.