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

[HELP] 关于虚拟目录访问404错误问题~~求救啊

[复制链接]
发表于 2015-1-19 14:17:02 | 显示全部楼层 |阅读模式
apache里搞了一个虚拟目录:
PHP复制代码
<VirtualHost *:80>
...
DocumentRoot /var/www/wwwroot
...
    Alias /mysite "/var/www/mysite/public"  
    <Directory "/var/www/mysite/public">  
        Options Indexes FollowSymLinks  
        AllowOverride All
        Order allow,deny  
        Allow from all  
    </Directory>
</VirtualHost>
复制代码


目录结构是这样的:
PHP复制代码
/var/www/mysite/
appliction
modules
public(虚拟目录的根目录)
    css
    js
    images
    index.php
system
.htaccess
复制代码



.htaccess是这样的:
PHP复制代码
# Turn on URL rewriting
RewriteEngine On
 
# Installation directory
RewriteBase /public/
 
# Protect hidden files from being viewed
<Files .*>
        Order Deny,Allow
        Deny From All
</Files>
 
# Protect application and system files from being viewed
RewriteRule ^(?:application|modules|system)\b.* index.php/$0 [L]
 
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
 
# Rewrite all other URLs to index.php/URL
RewriteRule .* index.php/$0 [PT]
 
# Disable damn mod_negotiation
Options -MultiViews
复制代码



然后:
http://localhost/mysite 能访问
http://localhost/mysite/index.php, 404错误
http://localhost/mysite/index.php/ 能访问
加上控制器的话:
http://localhost/mysite/user/login, 404错误
http://localhost/mysite/index.php/user/login能访问


怎么回事?
发表于 2015-2-10 09:18:17 | 显示全部楼层
是不是apache的apache的配置文件httpd.conf中将#LoadModule rewrite_module modules/mod_rewrite.so前的#去掉,再重启服务器。

本版积分规则