kkk 发表于 2010-10-11 15:52:12

CI中如何设置virtualhost?

首先,确定是开启了mod_rewrite......
工程名是find,服务器地址在D:\wamp\www

根目录下的.htaccess是这样的:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /find/index.php/$1
</IfModule>
<IfModule !mod_rewrite.c>
    ErrorDocument 404 /find/index.php
</IfModule>
这样就可以去掉index.php


问题是我怎么建立虚拟主机?

httpd.conf中式这样的:

<VirtualHost 127.0.0.8>
ServerName find.cc
DocumentRoot D:\wamp\www\find
</VirtualHost>


hosts中设置:
127.0.0.8find.cc

在浏览器中输入:find.cc.结果报500错误:
Internal Server ErrorThe server encountered an internal error or misconfiguration and was unable to complete your request.Please contact the server administrator, admin@localhost 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.
查看了错误日志:
Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.


请问怎么建立虚拟主机?

qi_ruo 发表于 2010-10-11 23:19:58

去掉.htaccess文件里的find目录看看 我试了下是可以的
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1
</IfModule>
<IfModule !mod_rewrite.c>
    ErrorDocument 404 index.php
</IfModule>

kkk 发表于 2010-10-12 09:11:03

回复 2# qi_ruo


   谢谢回答,删除目录,的确可以通过在浏览输入:find.cc可以访问并且index.php已经删去。   不过输入 http://localhost/find的时候,该地址显示的localhost的主界面......相当疑惑
页: [1]
查看完整版本: CI中如何设置virtualhost?