从 Code Igniter URL 中取出 index.php
我对 Code Igniter 非常陌生(因为我刚刚完成了他们的“官方”视频教程),我想知道是否有一种方法可以稍微清理一下 URL。
基本上,是否有一些设置可以将“index.php”保留在 URL 之外?
所以而不是这个...
.. .你看到这个:
或者我必须自己重写 URL .htaccess?
I'm very new to Code Igniter (as in I just finished their "official" video tutorial), and I was wondering if there was a way to clean up the URLs just a little bit more.
Basically, is there some setting to keep the "index.php" out of the URL?
So instead of this...
...you see this:
Or do I have to rewrite the URLs myself with .htaccess?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
使用 .htaccess 更容易,我猜其他方法可能不适用于共享主机。
我猜这样就可以了:
Using an .htaccess is easier, other ways wouldn't probably work on shared hosting I guess.
That would do I guess:
请遵循以下说明。
http://codeigniter.com/wiki/mod_rewrite/
就像 1 个 htaccess 文件和 1 个修改一样简单配置文件
Please follow the following instructions.
http://codeigniter.com/wiki/mod_rewrite/
As simple as 1 htaccess file and 1 modification to the config file
您不必“必须”使用 htaccess,但以任何其他方式执行它都会是一大堆混乱(想想在 php 中从 .../index.php/... 重定向到非 index.php 版本)。
任何称职的 php 开发人员都会在 .htaccess 中执行此操作。
You don't "have" to use the htaccess but doing it any other way would be a whole mass of kludge (Think redirecting in php from .../index.php/... to the non index.php version).
Any php dev worth their salt would do it in the .htaccess.