某些主机上的用户控制器区分大小写

发布于 2024-09-02 20:55:40 字数 595 浏览 7 评论 0原文

我们通常使用两种不同的托管服务。一方面,一切都可以用 Ticketyboo 进行,就像在我的本地开发服务器上一样。然而,在另一台服务器上,我遇到了这个问题:

我无法像这样访问用户控制器: http://www.example.com/users/login

但我可以喜欢这样: http://www.example.com/Users/login

** 注意大写的“Users” ' **

如果我将应用程序转移到子文件夹中,一切都会正常工作(大写和小写)。

托管公司已经查看了它,并没有发现他们的问题,他们向我保证用户不是保留字。

您可能会说这不是问题,只需使用有效的版本即可。不幸的是,这会导致下游出现问题,Cake 核心开始自行生成 url。

其他人见过这个问题或知道解决方案吗?

[这只发生在用户控制器上 - 所有其他控制器都按预期工作]

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]

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

假装不在乎 2024-09-09 20:55:40

如果没有看到您的所有代码/深入研究,我不确定这个问题的原因是什么。你的routes.php 文件中有一些特殊的东西吗?如果您为用户定义了特定的路线,那就可以了。

但是,您可以进行快速修复 - 在 UsersController(或 AppController,如果您想确保此行为不会在其他地方弹出)中,只需在 beforeFilter() 方法中添加一行以大写/取消大写(以更合适者为准)控制器参数。

[编辑] - 抱歉,没有完成第一段。它仍然可能是路由文件,即使它在一台服务器上运行而不是在另一台服务器上运行,因为工作服务器可能使用不区分大小写的 apache 模块来标准化所有 url。这就是为什么让您的登台和开发设置与生产环境完全相同的原因。

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.

旧故 2024-09-09 20:55:40

虽然托管支持否认“用户”或“用户”一词以任何方式保留,但似乎是:

“我们已删除用户/重定向”

问题已解决。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文