views:

22

answers:

2

We generally use two different hosting services. On one, everything works ticketyboo, as it does on my local dev servers. On the other server, however, I am having this problem:

I can't access the users controller like this: http://www.example.com/users/login

But I can like this: http://www.example.com/Users/login

** note the capitalised 'Users' **

If I displace the application to a sub-folder everything works fine (both upper- and lowercase).

The hosting company have looked at it and can't see a problem at their end and they assure me that users is not a reserved word.

You might say this isn't a problem, just use the version that works. Unfortunately it leads to problems downstream where Cake core starts generating urls itself.

Anybody else seen this problem or know the solution?

[This only occurs on the users controller - all others work as expected]

A: 

Without seeing all your code / diving in too deeply, I'm not sure what the cause of this problem is. Do you have some special stuff going on in the routes.php file? If you have a specific route defined for users, that could be it.

However, you could make a quick fix -- in UsersController (or AppController if you want to ensure this behavior doesn't pop up elsewhere) just add a line to the beforeFilter() method to capitalize / decapitalize (whichever is more appropriate) the controller parameter.

[edit] - sorry, didn't finish that first paragraph. It still could be the routes file, even though it works on one server and not the other, because it's possible that the working server uses a case-insensitive apache module that normalizes all urls. This is why it's so nice to have your staging and dev setups being EXACTLY the same as production.

Travis Leleu
It's quite a complex in-house CMS app and yes, there is some special stuff in the routing, but I'm certain that's not the problem. This ONLY occurs with users, ONLY when the app is in the root folder and ONLY on one server.
Leo
I've now deployed around forty CakePHP websites on about a dozen different hosting services without this problem, and two on this particular server that both have the problem.I might investigate your suggestion re. beforeFilter. Unfortunately dev and staging on the same setup is a rare luxury, although I do at least develop on Linux and Mac and publish on Linux. Beyond that I have little control. As the bulk of my work is delivery of this CMS, exactly-the-sameness would be totally impractical.
Leo
A: 

While the hosting support denied that the word 'user' or 'users' or 'Users' was in any way reserved, it seems that it was:

"We have removed the users/ redirect"

Problem solved.

Leo