从 urlstring 中删除 Index.php 后网站无法正常工作?
在我的旧网址中,它是 http://localhost/midas/index.php
我的网站正在使用 MVC 框架与代码点火器。
我在 Apache XAMPP 中激活了 mod_rewrite 并使用了以下 htaccess 代码:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php/$1 [NC,R=301,L]
当我输入基本 url 时,一切正常,我的主页会加载:
基本 url = http://localhost/midas/
但是,当我单击导航菜单或链接时,我收到 404 未找到对象错误消息。
Apache 错误消息:
[2011 年 7 月 12 日星期二 13:48:55] [错误] [客户端 127.0.0.1] 文件不存在:C:/xampp/htdocs/midas/site,引荐来源:http://localhost/midas/
有什么我需要更改的地方吗?
In my old url it was http://localhost/midas/index.php
My site is using MVC framwork with CodeIgniter.
I activated mod_rewrite in Apache XAMPP and used the following htaccess code:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php/$1 [NC,R=301,L]
When I enter my base url it is fine and my home page loads up:
base url = http://localhost/midas/
However when I click on my navigation menu or links I get a 404 object not found error message.
Apache Error Message:
[Tue Jul 12 13:48:55 2011] [error] [client 127.0.0.1] File does not exist: C:/xampp/htdocs/midas/site, referer: http://localhost/midas/
Is there something I need to change somewhere?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
编辑
/application/config/config.php
并更改为
此外,启用
mod_rewrite
后,您需要重新启动 Apache。这是我与 CodeIgniter 一起使用的
.htaccess
(经过修改,因此它应该适合您):它应该位于您的根目录中(即
C:\xampp\htdocs\midas)。
Edit
/application/config/config.php
and changeto
Also, you will need to restart Apache after you've enabled
mod_rewrite
.This is the
.htaccess
I'm using with CodeIgniter (modified so it should work for you):It should be in your root directory (i.e.
C:\xampp\htdocs\midas
).您可能需要在 htaccess 中设置 RewriteBase
,请参阅:http://httpd.apache .org/docs/current/mod/mod_rewrite.html
我的猜测是
(就在
RewriteEngine
之后)You might need to set a RewriteBase in your htaccess
see: http://httpd.apache.org/docs/current/mod/mod_rewrite.html
My guess would be
(right after
RewriteEngine
)