如果没有 .htaccess 可用性,CodeIgniter 无法在 PHP 4 服务器上运行
基本上我在本地主机 wamp 服务器上使用 PHP 5 开发了我的应用程序。在上传到实际主机时,我注意到
- 服务器正在运行 php 4.4.9
- 每次我上传 .htaccess 文件时,服务器都会将其完全删除..似乎不是允许
- 当我测试该设置时,我得到的只是一个未找到的 404 页面
有关如何使其在此 PHP 4 服务器上工作的任何帮助吗?
我用 CI 1.7.2 做了测试,默认安装..在我的本地服务器上可以工作,但是上传时不起作用,这是否意味着服务器不支持它?
Basically i developed my app on a localhost wamp server with PHP 5. ON uploading to the actual host i notice that
- The server is running php 4.4.9
- Everytime i upload my .htaccess file, the server removes it completely.. seems to not be allowed
- When i test out the set all i get is a 404 page not found
Any help on how to make it work on this PHP 4 server?
I did a test with CI 1.7.2, default installation.. works on my local server but when uploaded does not work, does this mean that the server does not support it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我确信这不是您想要的,但是获取一个新服务器。原因如下:
其要点是,您将不得不将代码修改回黑暗时代才能使其正常工作,然后您仍然会遇到相当大的 URL 问题和整体系统不稳定。如果你能做出改变,那就去做吧。
I'm sure this isn't what you want to here, but get a new server. Here are the reasons why:
The gist of this is you are going to have to hack your code back into the dark ages to get this to work, and then you will still have pretty URL issues and overall system instability. If you can make the switch, do.
如果您无法将 .htaccess 文件与 CodeIgniter 一起使用,则在
system/application/config/config.php
中有一个名为index_page
的配置键。您需要将其设置为引导 CodeIgniter 的任何页面(通常是/index.php
)然后,确保通过 CI 路由的所有链接都指向
index.php/controller/action /params...
或利用 URL 帮助程序(使用site_url
或anchor
)自动放入 index.phpJoe Mills 的回答完全正确, 尽管。 CI 最适合与 PHP 5 和 .htaccess 配合使用。
请参阅 CI URL 和 CI URL Helper 用于文档。
If you cannot use .htaccess files with CodeIgniter, in
system/application/config/config.php
there is a configuration key calledindex_page
. You need to set that to whatever page you have bootstrapping CodeIgniter (usually/index.php
)Then, make sure all your links that get routed through CI either target
index.php/controller/action/params...
or utilize the URL helper (withsite_url
oranchor
) to automatically put in the index.phpJoe Mills is exactly right in his answer, though. CI works best with PHP 5 and .htaccess.
See CI URLs and CI URL Helper for documentation.
好吧,我发现了如何解决一些问题
Well i found out how to fix several things