972578649 发表于 2013-3-20 10:19:24

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

我这边要是打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”   则访问正常



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

amu 发表于 2013-3-20 10:19:25

查看你的.htaccess文件设置,有没有把login排除在外,或是你根本没有配置隐藏index.php这个功能。


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

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

amu 发表于 2013-3-20 10:30:36

我晕,这论坛插入数据有问题。在\前面加了转义

972578649 发表于 2013-3-20 10:33:08

amu 发表于 2013-3-20 10:28 static/image/common/back.gif
查看你的.htaccess文件设置,有没有把login排除在外,或是你根本没有配置隐藏index.php这个功能。




这是我的.htaccess文件



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

amu 发表于 2013-3-20 10:35:40

对htaccess不是太懂。如果按你上面这种写法,你试试我下面的这种

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1

972578649 发表于 2013-3-20 10:39:08

amu 发表于 2013-3-20 10:35 static/image/common/back.gif
对htaccess不是太懂。如果按你上面这种写法,你试试我下面的这种

RewriteCond %{REQUEST_FILENAME} !-d


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


可以私聊下吗??

dogwin 发表于 2013-3-21 17:41:27

.htaccess

RewriteEngine on
#RewriteRule ^$ /index.php
RewriteRule ^(.*)$ index.php/$1
页: [1]
查看完整版本: 求大神帮忙,困扰一天了啊!!!!!