【发布时间】:2013-12-21 15:16:09
【问题描述】:
首先,我是FuelPHP的新手,所以这会很容易,但我在互联网上找不到答案,所以我希望你们能帮助我。
问题是我正在关注关于FuelPHP 的THIS 教程。
我在D:\www_ander\webshop 中设置了一个带有虚拟目录的 wamp。那是带有.htaccess 和index.php 以及文件夹assets 的根目录
我在文件夹www_ander 中有fuel 文件夹。
我已经按照教程所说的(编辑配置/自动加载,创建文件和数据库)使用以下命令(我在文件夹 D:\www_ander 的命令提示符中运行了这个)
php oil generate scaffold messages name:string message:text
php oil refine migrate
我没有收到任何错误,并且数据库已成功创建。但是当我访问我的网站时(这是本地主机,我已经编辑了 windows 的主机文件):
http://webshop.nl/messages/
我得到一个404, Not Found 页面。我什至尝试将 /index/ 附加到 URL 中,但这也不起作用。
所以我的问题是,我做错了什么?为什么这不能正常工作?!?是我的网址错误还是其他问题?
也许无关紧要,但这里是.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>
----- 更新 ------
我仍在寻找答案,但我已经找到了解决方法。当我访问http://webshop.nl/index.php/messages/ 时,它确实有效。所以看起来 .htaccess 没有完全工作。但据我所知,它应该可以工作。那么你们知道哪里出了问题吗?
【问题讨论】:
标签: php .htaccess http-status-code-404 fuelphp