xaero 发表于 2015-1-19 14:17:02

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

apache里搞了一个虚拟目录:
<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>

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


.htaccess是这样的:
# 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

# 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

# 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能访问


怎么回事?

luofuchuan 发表于 2015-2-10 09:18:17

是不是apache的apache的配置文件httpd.conf中将#LoadModule rewrite_module modules/mod_rewrite.so前的#去掉,再重启服务器。
页: [1]
查看完整版本: 关于虚拟目录访问404错误问题~~求救啊