我有这个用于Codeigniter 2.2.0的.htaccess
文件,当我在控制器中使用子目录时效果很好。但在Codeigniter 3.0中,我无法通过链接http://localhost/myproject
尽管如此,以下链接有效:
http://localhost/myproject/index.php/frontend/home
http://localhost/myproject/frontend/home
我的路线定义明确
$route['default_controller'] = 'frontend/home/index';
我的.htaccess
Options -Indexes
Options +FollowSymLinks
# Set the default file for indexes
DirectoryIndex index.php
<IfModule mod_rewrite.c>
# activate URL rewriting
RewriteEngine on
# do not rewrite links to the documentation, assets and public files
RewriteCond $1 !^(index\.php|public|robots\.txt)
# do not rewrite for php files in the document root, robots.txt or the maintenance page
RewriteCond $1 !^([^\..]+\.php|robots\.txt|sitemap\.xml)
# but rewrite everything else
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
ErrorDocument 404 index.php
</IfModule>
答案 0 :(得分:0)
在godaddy中,所有控制器类的首字母必须是大写的。在codeigniter 3.0中工作100% - &gt;
像: 申请&gt;控制器&gt;的ħ强> ome.php