2013-12-21 43 views
0

首先,我是FuelPHP的新手,所以它会非常简单,但我无法在互联网上找到答案我希望你们能帮助我。fuelphp无法访问该页面(.htaccess不工作...)

问题是,我正在关注FuelPHP的THIS教程。

我已经在D:\www_ander\webshop中设置了一个虚拟目录的wamp。这是与.htaccessindex.phpassets

我已经得到了fuel文件夹中的文件夹www_ander在文件夹的根目录。

我做的教程所说的话(编辑config /自动加载,创建文件和数据库)用下面的命令(我跑这个命令PROMT从文件夹D:\www_ander

php oil generate scaffold messages name:string message:text 
php oil refine migrate 

我不没有任何错误,并且数据库被成功创建。但是,当我去我的网站(这是本地主机,我已经edidted窗口的主机文件):

http://webshop.nl/messages/ 

我得到一个404, Not Found页。我甚至试着用/index/追加到URL中,但那也行不通。

所以我的问题是,我错了什么?为什么不这样做呢?!?我的网址错了还是另一个问题?

Mayby inrellevant,但这里是.htaccess文件:

# Multiple Environment config, set this to development, staging or production 
# SetEnv FUEL_ENV production 

<IfModule mod_rewrite.c> 

    # Make sure directory listing is disabled 
    Options +FollowSymLinks -Indexes 
    RewriteEngine on 

    # NOTICE: If you get a 404 play with combinations of the following commented out lines 
    #AllowOverride All 
    #RewriteBase /wherever/fuel/is 

    # Restrict your site to only one domain 
    # !important USE ONLY ONE OPTION 

    # Option 1: To rewrite "www.domain.com -> domain.com" uncomment the following lines. 
    #RewriteCond %{HTTPS} !=on 
    #RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] 
    #RewriteRule ^(.*)$ http://%1/$1 [R=301,L] 

    # Option 2: To rewrite "domain.com -> www.domain.com" uncomment the following lines. 
    #RewriteCond %{HTTPS} !=on 
    #RewriteCond %{HTTP_HOST} !^www\..+$ [NC] 
    #RewriteCond %{HTTP_HOST} (.+)$ [NC] 
    #RewriteRule ^(.*)$ http://www.%1/$1 [R=301,L] 

    # Remove index.php from URL 
    RewriteCond %{HTTP:X-Requested-With} !^XMLHttpRequest$ 
    RewriteCond %{THE_REQUEST}    ^[^/]*/index\.php [NC] 
    RewriteRule ^index\.php(.*)$   $1 [R=301,NS,L] 

    # Send request via index.php (again, not if its a real file or folder) 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 

    # deal with php5-cgi first 
    <IfModule mod_fcgid.c> 
     RewriteRule ^(.*)$ index.php?/$1 [QSA,L] 
    </IfModule> 

    <IfModule !mod_fcgid.c> 

     # for normal Apache installations 
     <IfModule mod_php5.c> 
      RewriteRule ^(.*)$ index.php/$1 [L] 
     </IfModule> 

     # for Apache FGCI installations 
     <IfModule !mod_php5.c> 
      RewriteRule ^(.*)$ index.php?/$1 [QSA,L] 
     </IfModule> 

    </IfModule> 

</IfModule> 

------ UPDATE ------

我还在寻找答案,但我已经找到了解决方法。当我访问http://webshop.nl/index.php/messages/它确实有效。所以它看起来像.htaccess没有完全工作。但据我看,它应该工作。那么你们知道什么可能是错的?

回答

0

我已经找出问题所在。 Id必须处理我的虚拟主机设置。

事情是,我没有指定允许旁白。所以,当我插入这一部分在我的虚拟主机文件,它的工作:

<Directory "D:\www_ander"> 
    AllowOverride All 
</Directory> 

所以整个虚拟主机的文件现在看起来是这样的:

<Directory D:\www_ander\> 
    Order Deny,Allow 
    Allow from all 
</Directory> 

<VirtualHost *:80> 
    DocumentRoot "D:\www_ander" 
    ServerName webshop.nl 
    ServerAlias www.webshop.nl 
    <Directory "D:\www_ander"> 
     AllowOverride All 
    </Directory> 
</VirtualHost>