Codeigniter控制器/视图“ Pretty Uri”不起作用 [英] Codeigniter controller/views 'pretty uri' not working
问题描述
我是一个完整的Codeigniter菜鸟。
I'm a complete Codeigniter noob.
我认为我已经正确设置了所有内容,并且在访问以下页面时会显示页面:
I think I have everything setup properly, and the pages display when I go to:
http://www.example.com/index.php/pages/view/my_page
,但是在没有index.php文件的情况下访问Apache 404错误:
but I get an Apache 404 error when I visit without the index.php file:
http://www.example.com/pages/view/my_page
有什么明显的我想念的吗? .htaccess规则还是控制器的更改?
Is there anything obvious I'm missing? .htaccess rules, or a change in the controller?
推荐答案
默认情况下,index.php文件将包含在您的URL中
By default, the index.php file will be included in your URL
您可以使用 .htaccess 轻松删除此文件a>具有一些简单规则的文件。这是使用负方法的此类文件的示例,其中重定向除了指定项目外的所有内容:
You can easily remove this file by using a .htaccess file with some simple rules. Here is an example of such a file, using the "negative" method in which everything is redirected except the specified items:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
这篇关于Codeigniter控制器/视图“ Pretty Uri”不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!