2

I need an advice on researching the following issue.

Wheels website has set(URLRewriting="On") configured, everything looks fine except root page.

All links built with linkTo look like website.tld/controller/action.

But on a / mode "switched" into the partial and links look like website.tld/index.cfm/controller/action. Interestingly, if default route page accessed explicitly (/pages/index in this case) -- URLs built properly.

Website is running in Tomcat with Apache2 under Ubuntu, standard Wheels rewriting rules configured directly in a vhost config, as a workaround to known issue with .htaccess.

Where to start? What variables to check and how to debug this?

Thanks.

UPD All I can see for now is that when default action accessed directly there's no Route: home in the debug output. Not sure how to use this info, I have very small experience with Wheels.

Sergey Galashyn
  • 6,946
  • 2
  • 19
  • 39
  • 1
    Not sure if this is the answer, so I'll leave as a comment. Usually Wheels will ignore `set(urlRewriting="On")` if you're not rewriting to `rewrite.cfm`. Make sure that requests are routing through `rewrite.cfm` and not `index.cfm`. – Chris Peters Jun 11 '11 at 14:04
  • @Chris I've checked the CGI scope and the script was `index.cfm`. I've fixed the rewriting rules and now everything is fine, please post your comment as answer, I will mark it accepted. – Sergey Galashyn Jun 11 '11 at 15:53

2 Answers2

2

I have a very similar setup and ran into the same problem just now. As a temporary workaround I found that by changing line 294 of wheels/global/public.cfm from

loc.returnValue = application.wheels.webPath & ListLast(request.cgi.script_name, "/");

to

loc.returnValue = application.wheels.webPath;

that linkTo() built a path that worked with URL rewriting. I'll ping some friends more familiar with Wheels to see if there's a patch required to fix this.

Robin Hilliard
  • 489
  • 4
  • 6
  • I just realised this might not be exactly the same situation - my problem was that linkTo() was writing /index.cfm/controller/action when rewriting was enabled instead of /controller/action. – Robin Hilliard Jun 11 '11 at 04:25
  • Robin, your problem looks exactly the same -- incorrect inserting of `/index.cfm/` into the generated URL. Thanks for the workaround, though also I'd like to hear some thoughts from Wheels developers, I know some of them are SO users too. – Sergey Galashyn Jun 11 '11 at 07:33
2

Since Chris Peters did not create the answer, I'll do this instead just to mark the question resolved. All glory to Chris, any way.

Usually Wheels will ignore set(urlRewriting="On") if you're not rewriting to rewrite.cfm. Make sure that requests are routing through rewrite.cfm and not index.cfm

It means that you need to check the CGI scope on the problematic pages and fix the rewriting workaround rules (there are few of them for Tomcat+CFWheels, I think).

Sergey Galashyn
  • 6,946
  • 2
  • 19
  • 39
  • Just now noticed that you asked me to put it as an answer. Gotta check my email notification settings. :-/ Glad you got it sorted out though! – Chris Peters Jun 16 '11 at 12:45