IIS7 Url Rewrite Rules

Guys,

I have a Windows 2008 server running IIS7, the Microsoft URL Rewrite tool, and a Tomcat/Railo deployment. IIS and Tomcat are hooked up and working just fine such that standard links like http://www.domain.com/index.cfm?test work just fine.

My goal is to have the above url work as http://www.domain.com/test/ where the request would be re-routed to the index.cfm passing the /test part as a query argument.

I added the IIS rewrite rules as described in this blog posting … http://blog.coldbox.org/post.cfm/coldbox-and-url-rewrites-with-iis-7. When I do so, both the url http://www.domain.com/index.cfm/test/ and http://www.domain.com/test/ resolve to the index.cfm file. However, the ‘test’ part is gone.

I have played with the rules and gone through the Microsoft documentation for the rewrite tool with no luck. Has anybody tried these rules or run into anything like this before?

Thanks

– Jeff

Hi Jeff,

I think what you need to do is setup a route as such:

addRoute(pattern=“test”,handler=“main”,action=“index”,matchvariables=“test=”);

cheers,

Bill

These are the rules that I have tried before for the IIS rewrite tool:

<?xml version="1.0" encoding="UTF-8"?>

Luis F. Majano
President
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Thanks Luis. I overwrote my web.config with the configuration you provided with the same result. At this point I have not setup ColdBox on this site yet, just trying to get the url rewrite to work.

Given that, I was dumping out the url and CGI scopes to test to see if the rules were working and I am getting nothing in the URL scope and the CGI.PATH_INFO variable is also empty.

So, are the rules not working or am I missing something else here?

Thanks

– Jeff

Hmm, interesting, I know jason durham set it up using those web.config rules. I think the web.config can import .htaccess rules. Have you tried to import the included .htaccess rules from the distro install folder?

Ohhh, also, make sure that the cf engine has enabled the path info in the servlet declaration. I know by default it comes unchecked in the web.xml.

Luis F. Majano
President
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Luis,

It looks like the problem is not the rules after all, but Railo. I created a new site running CF9 using your rules and the path_info variable was set correctly.

I checked the servlet declaration you mentioned and that is setup right, so I will move this over to the Railo list.

Thanks for the help.

– Jeff

Anytime Jeff,

Is this on tomcat? It might be that tomcat does not allow the .cfm/ servlet mapping as it is not standard servlet container mapping. So I think you will have to do something else on the rewrite, I am guessing.

Luis F. Majano
President
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com