问题
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.
回答1:
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.
回答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).
来源:https://stackoverflow.com/questions/6312509/different-rewrite-mode-for-cfwheels-website-root