+ -
当前位置:首页 → 问答吧 → apache 配置 rewrite 404 找不到页面 帮忙纠错

apache 配置 rewrite 404 找不到页面 帮忙纠错

时间:2011-09-06

来源:互联网

apache2.2.9

1 httpd.conf 手动添加了以下内容

LoadModule rewrite_module modules/mod_rewrite.so

LoadModule php5_module D:/lamp/php5/php5apache2_2.dll
PHPIniDir "D:/lamp/php5"

AddType application/x-httpd-php .php
AddType application/x-httpd-php .html

Include D:/lamp/wwwroot.conf

2 D:/lamp/wwwroot.conf内容
DocumentRoot "D:/lamp/wwwroot"
<Directory "D:/lamp/wwwroot">
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
<IfModule dir_module>
    DirectoryIndex index.php
</IfModule>

3. 在D:\lamp\wwwroot下创建了.htaccess文件
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>

4.在D:\lamp\wwwroot 创建了index.php入口文件,并指定项目为home文件夹下,在D:\lamp\wwwroot\home\Conf\config.php
设置
<?php
return array(
//'配置项'=>'配置值'
'URL_MODEL'=>2,
'URL_HTML_SUFFIX'=>'.html',
);
?>


完全按照教程配置,但运行 http://localhost/index/index 报404 无法找到网页错误
如果运行 http://localhost/index.php/index/index 就没问题

作者: fanyingnedu   发布时间: 2011-09-06

AllowOverride None
改成 ALL

作者: fanyingnedu   发布时间: 2011-09-10