从 Kohana 2.x 中的 URL 中删除 index.php
我想将 Kohana 2.x 配置为具有以下格式的链接:
http://localhost/mysite/web/admin/support
而不是这样:
http://localhost/mysite/web/admin/index.php/support
我从 config.php 文件 ( $config['index_page'] = '';)
并且我在 .htaccess 文件中添加了以下行:
RewriteRule ^(.*)$ /index.php?/$1 [L]
如果将鼠标悬停在链接上方,您可以看到链接就像我想要的那样,但总是出现此错误:
未找到
在此服务器上找不到请求的 URL /mysite/web/admin/support
我不知道如何像我想要的那样更改配置。
I want to configure Kohana 2.x to have links in this format:
http://localhost/mysite/web/admin/support
instead of this:
http://localhost/mysite/web/admin/index.php/support
I removed the index.php
from the config.php file ( $config['index_page'] = '';)
and I added the following line in the .htaccess file:
RewriteRule ^(.*)$ /index.php?/$1 [L]
If you hover above a link you can see that the links are like I wanted them but there is always this error:
Not Found
The requested URL /mysite/web/admin/support was not found on this server
I don't know how to change the configuration like I want to.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 htaccess:: 中写入以下代码,
也可以将 config.php 文件更改为:
另一种尝试
尝试更多解决方案,然后查看
如何正确设置Kohana的.htaccess,使URL中没有难看的“index.php/”?
另请参阅以下内容::
http://kohanaframework.org/3.0/guide/kohana/tutorials/clean-网址
Write following code in htaccess::
you can also change the config.php file to:
another one try
try more solution then see
How to set up .htaccess for Kohana correctly, so that there is no ugly "index.php/" in the URL?
see also following tuts::
http://kohanaframework.org/3.0/guide/kohana/tutorials/clean-urls