natici 发表于 2009-8-31 01:49:36

url重写问题,看过论坛上所有rul重写的帖子都无法解决

httpd.conf里有如下行:LoadModule rewrite_module modules/mod_rewrite.so
另外在ci根目录下已有.htaccess文件,内容如下:

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /CodeIgniter/public/index.php/$1

我的ci目录结构如下:
CodeIgniter为根目录,下有application,system和public。其实就是把application目录移到system外面了,然后新建public目录作为外网可访问的目录。同时把index.php移到public里了。

但我输入:http://localhost/codeigniter/public/admin/backdoor/ 后有如下提示:

Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, 1 and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. -------------------------------------------------------------------------------- Apache/2.2.4 (Win32) PHP/5.2.3 Server at localhost Port 80





这到底是啥问题?ci的问题?apache的问题?具体要如何解决?

visvoy 发表于 2009-8-31 09:00:15

<IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /codeigniter/public/
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond $1 !^(index.php|images|robots\.txt)
        RewriteRule ^(.*)$ index.php/$1
</IfModule>
<IfModule !mod_rewrite.c>
        ErrorDocument 404 /codeigniter/public/index.php
</IfModule>

单独拉出public目录,index.php要改内容,把几个路径改成../xxxx

natici 发表于 2009-8-31 10:52:40

感谢斑竹的帮助,我把你的RewriteRule ^(.*)$ index.php/$1
改成RewriteRule ^(.*)$ /codeigniter/public/index.php/$1 之后就可以了
页: [1]
查看完整版本: url重写问题,看过论坛上所有rul重写的帖子都无法解决