Different rewrite mode for CFWheels website root
Asked Answered
J

2

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.

Jacintha answered 10/6, 2011 at 22:0 Comment(2)
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.Soulsearching
@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.Jacintha
J
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).

Jacintha answered 13/6, 2011 at 18:31 Comment(1)
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!Soulsearching
C
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.

Cyclograph answered 11/6, 2011 at 4:20 Comment(2)
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.Cyclograph
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.Jacintha
J
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).

Jacintha answered 13/6, 2011 at 18:31 Comment(1)
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!Soulsearching

© 2022 - 2024 — McMap. All rights reserved.