用户
 找回密码
 入住 CI 中国社区
搜索
查看: 1805|回复: 6
收起左侧

求大神帮忙,困扰一天了啊!!!!!

[复制链接]
发表于 2013-3-20 10:19:24 | 显示全部楼层 |阅读模式
2CI币
我这边要是打  http://localhost 地址就会直接跳到  http://localhost/login  然后直接报错   The requested URL /login was not found on this server.



但我要是在  http://localhost/login 中加上   index.php 如:“http://localhost/index.php/login”   则访问正常



请问这是怎么回事啊!!!!!!!!

最佳答案

查看完整内容

查看你的.htaccess文件设置,有没有把login排除在外,或是你根本没有配置隐藏index.php这个功能。 RewriteCond $1 !^(index\.php|files) RewriteRule ^(.*)$ index.php/$1 [L] 上面的files目录属于排除在外的目录。即访问该目录的时候不属于隐藏入口index.php,而是直接访问目录。除此之外其它任何路径或url参数都通过index.php解析。 ...
发表于 2013-3-20 10:19:25 | 显示全部楼层
查看你的.htaccess文件设置,有没有把login排除在外,或是你根本没有配置隐藏index.php这个功能。


RewriteCond $1 !^(index\.php|files)
RewriteRule ^(.*)$ index.php/$1 [L]

上面的files目录属于排除在外的目录。即访问该目录的时候不属于隐藏入口index.php,而是直接访问目录。除此之外其它任何路径或url参数都通过index.php解析。
回复

使用道具 举报

发表于 2013-3-20 10:30:36 | 显示全部楼层
我晕,这论坛插入数据有问题。在\前面加了转义
回复

使用道具 举报

 楼主| 发表于 2013-3-20 10:33:08 | 显示全部楼层
amu 发表于 2013-3-20 10:28
查看你的.htaccess文件设置,有没有把login排除在外,或是你根本没有配置隐藏index.php这个功能。

这是我的  .htaccess  文件  



<IfModule mod_rewrite.c>
    RewriteEngine On
#   RewriteBase /
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>
回复

使用道具 举报

发表于 2013-3-20 10:35:40 | 显示全部楼层
对htaccess不是太懂。如果按你上面这种写法,你试试我下面的这种

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
回复

使用道具 举报

 楼主| 发表于 2013-3-20 10:39:08 | 显示全部楼层
amu 发表于 2013-3-20 10:35
对htaccess不是太懂。如果按你上面这种写法,你试试我下面的这种

RewriteCond %{REQUEST_FILENAME} !-d

刚试了一下不行啊!!!!


可以私聊下吗??
回复

使用道具 举报

发表于 2013-3-21 17:41:27 | 显示全部楼层
.htaccess

RewriteEngine on
#RewriteRule ^$ /index.php [L]
RewriteRule ^(.*)$ index.php/$1 [L]
回复

使用道具 举报

本版积分规则