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

[HELP] CI中如何设置virtualhost?

[复制链接]
发表于 2010-10-11 15:52:12 | 显示全部楼层 |阅读模式
首先,确定是开启了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 [L]
</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.8  find.cc

在浏览器中输入:find.cc.结果报500错误:
Internal Server Error

The 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.


查看了错误日志:


[error] [client 127.0.0.8] 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.


请问怎么建立虚拟主机?
发表于 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 [L]
</IfModule>
<IfModule !mod_rewrite.c>
    ErrorDocument 404 index.php
</IfModule>
 楼主| 发表于 2010-10-12 09:11:03 | 显示全部楼层
回复 2# qi_ruo


   谢谢回答,删除目录,的确可以通过在浏览输入:find.cc可以访问并且index.php已经删去。   不过输入 http://localhost/find的时候,该地址显示的localhost的主界面......相当疑惑

本版积分规则