Apache的重写规则。*的index.php [NC,L]不工作 [英] Apache RewriteRule .* index.php [NC,L] Not working

查看:618
本文介绍了Apache的重写规则。*的index.php [NC,L]不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从我的/网页/文件夹/目录重定向一切都在一个页面。

我添加了一个简单的.htaccess这个简单的code(我知道这将需要更多的code在.htaccess,但它只是一个测试)。

  RewriteEngine叙述上
重写规则。*的index.php [NC,L]
 

当我尝试:

  http://127.0.0.1:8888/website/folder/fileDoesntExistMustGoIndex
 

我有一个未找到对象404错误和access.log中显示:

  127.0.0.1  -   -  [13 /月/ 2010:13:48:31 -0500]GET /website/folder/fileDoesntExistMustGoIndexHTTP/1.1404 1118
 

我检查了httpd.conf中,我看到没有什么可以改变这个的.htaccess声明。你知道吗?

编辑:

  RewriteEngine叙述上
重写规则。* http://www.google.ca [NC,L]
 

本作品...但不是当我尝试重写我的页面。

解决方案

  RewriteEngine叙述上
的RewriteBase /
重写规则。的index.php
 

也尝试

  RewriteLogrewrite.log
RewriteLogLevel 3
 

要看看会发生什么。

I am trying to redirect everything to a single page from my /website/folder/ directory.

I added a simple .htaccess with this simple code (I know this would require more code in .htaccess but it's just a test).

RewriteEngine on
RewriteRule .* index.php [NC,L]

When I try :

http://127.0.0.1:8888/website/folder/fileDoesntExistMustGoIndex

I have an "Object not found 404" error and the access.log display:

127.0.0.1 - - [13/Mar/2010:13:48:31 -0500] "GET /website/folder/fileDoesntExistMustGoIndexHTTP/1.1" 404 1118

I have check the httpd.conf and I see nothing that could alter this .htaccess statement. Any idea?

Edit:

RewriteEngine on
RewriteRule .* http://www.google.ca [NC,L]

This works... but not when I try to rewrite to a page of mine.

解决方案

RewriteEngine On
RewriteBase /
RewriteRule . index.php

also try

RewriteLog "rewrite.log"
RewriteLogLevel 3

to see what happens

这篇关于Apache的重写规则。*的index.php [NC,L]不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆