使用cess框架和lighttpd时去掉URL中的index.php
我正在使用带有lighttpd的Lescess php框架
有谁知道我如何使用以下较短的网址:
http://www .myserver.com/recess
而不是:
http://www.myserver.com /index.php/recess
休息自述文件说,如果我有 mod_rewrite,我可以使用较短的 url:
-- “你有 mod_rewrite 吗?
-- 是:打开浏览器到解压缩的位置
-- 否:打开浏览器到解压后的位置,然后是index.php”
我确实在lighttpd上启用了mod_rewrite并且我已经删除了index.php,但我得到了404。
我的lighttpd.conf中需要任何特殊规则吗?
I am using the recess php framework with lighttpd
Does anyone know how I can use the shorter urls of:
http://www.myserver.com/recess
Instead of:
http://www.myserver.com/index.php/recess
The recess readme file says that if I have mod_rewrite I can use the shorter url:
-- "Do you have mod_rewrite?
-- Yes: Open your browser to the location you unzipped
-- No: Open your browser to the location you unzipped followed by index.php"
I do have mod_rewrite enabled on lighttpd and i have removed the index.php but I get a 404.
Do I need any special rules in my lighttpd.conf?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
检查 CakePHP 文档中的相关页面是否可以帮助您。有一节介绍如何设置 lighttpd 和美化 URL。
Check if the relevant page from CakePHP documentation can help you. There's a section on how to setup lighttpd and prettify URLs.
要从 URL 中隐藏
index.php
,您可能需要重写一些规则,如下所示:To hide
index.php
from urls, you may want to some re-write rules something like this:感谢大家的评论,我根据 cakephp 文档使重写规则正常工作(是的,它们与 apache 完全不同)。但在休息框架中仍然出现错误。所以切换到cakephp,因为它直接支持lighttpd并在lighttpd上进行测试。
thanks all for your comments, I got the rewrite rules working (yes they are completely different to apache ones) based on cakephp docs. But still got errors in the recess framework. so switched to cakephp due to it directly supporting and being tested on lighttpd.
实际上,apache的mod-rewrite与index.php无关
这是另一个 apache 指令 -
DirectoryIndex
责任。但是,由于您使用的是另一台网络服务器,而不是流行的服务器,因此您必须为此查阅网络服务器文档。
我认为你必须首先打开 PHP 支持
actually, apache's mod-rewrote has nothing to do with index.php
it's another apache directive -
DirectoryIndex
responsibility.But as you're using another web-server, not a popular one, you have to consult your web-server documentation for this.
I think you have to turn PHP support on first