关于控制器放置在子文件夹中,URL中包含index.php的问题!
今天刚接触CI,绝对新人,呵呵!我按照文档中的指导说明
按如下显示路径可以正常显示
example.com/index.php/products/shoes/show/123
但是,这个路径看起来有点别扭,多了一个 index.php,去掉index.php后,路径如下
example.com/products/shoes/show/123
但却是显示无法找到该页
我不清楚我这种要求的话,是要求 routers.php文件该如何设置呢? 这种要设置服务器rewrite .htaccess
RewriteEngine on
RewriteCond $1 !^(index\.php|images|style|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 谢谢楼上的,但是我的虚拟目录不是根目录
是 http://localhost/ciapp/index.php 这种格式,改成
RewriteRule ^(.*)$ ciapp/index.php/$1
也不行。
apache的日志是:
File does not exist: E:/soft/PhpFramework/CodeIgniter_2.0.0/admin
我是自己建了一个虚拟目录,E:/soft/PhpFramework/CodeIgniter_2.0.0/ 对应 http://localhost/ciapp 所以此处解析将admin解析成了虚拟目录了,而这个目录在E:/soft/PhpFramework/CodeIgniter_2.0.0/admin 肯定是不对的,而是 E:/soft/PhpFramework/CodeIgniter_2.0.0/admin/application/controllers/admin 我看了一下http.conf (我用的是wamp,虚拟目录是通过命令行工具创建的)
最后一行是:Include "d:/wamp/alias/*"
其中有一个文件 ciapp.conf 配置如下:
Alias /ciapp/ "E:/soft/PhpFramework/CodeIgniter_2.0.0/"
<Directory "E:/soft/PhpFramework/CodeIgniter_2.0.0/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
Allow from all
</Directory> 这个问题废了我几个小时,呵呵,我的.htaccess 文件没有起作用,我该设置的都设置了,本机另一个非CI的应用可以用 .htaccess 所以 apache的设置没有问题,我不知道CI是否有设置,我直接在 httpd.conf引用的 ciapp.conf中奖rewrite规则加进去就可以转发url了
问一下大虾们 CI是否有设置开启或禁用 .htaccess ??
页:
[1]