weird behavior: Apache mod rewrite

Hello everyone, this is my first time in this mailing list.
Using: PHP Version 5.2.10-2ubuntu6.4, Apache/2.2.12

I'm redirecting all the request into one file with ( .htaccess ):

RewriteEngine On
RewriteRule .* index.php

My index code is:

<?php echo $_SERVER["REDIRECT_URL"]; ?>

In the same directory I just have other file besides index.php. And
depends on how this file is named, I'm getting
different values for the same request:

Request: /menu.html

Filename: menu.html
Output: /menu.html
Result: OK!

Filename: menu.html.bak
Output: /menu.html.bak
Result: NOT GOOD!

Filename: menu.html.whatever.other
Output: ERROR 404 (from apache)
Result: NOT GOOD!

Could someone please explain me why I'm getting this weird behavior?

As the request is the same, I expected to display always the same
value. Am I'm wrong??

Thank you.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Alberto Lepe [ Fr, 26 Februar 2010 10:39 ] [ ID #2033545 ]

Re: weird behavior: Apache mod rewrite

--=-HL04gYWYRoMgdria0YVD
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

On Fri, 2010-02-26 at 18:39 +0900, Alberto Lepe wrote:

> Hello everyone, this is my first time in this mailing list.
> Using: PHP Version 5.2.10-2ubuntu6.4, Apache/2.2.12
>
> I'm redirecting all the request into one file with ( .htaccess ):
>
> RewriteEngine On
> RewriteRule .* index.php
>
> My index code is:
>
> <?php echo $_SERVER["REDIRECT_URL"]; ?>
>
> In the same directory I just have other file besides index.php. And
> depends on how this file is named, I'm getting
> different values for the same request:
>
> Request: /menu.html
>
> Filename: menu.html
> Output: /menu.html
> Result: OK!
>
> Filename: menu.html.bak
> Output: /menu.html.bak
> Result: NOT GOOD!
>
> Filename: menu.html.whatever.other
> Output: ERROR 404 (from apache)
> Result: NOT GOOD!
>
> Could someone please explain me why I'm getting this weird behavior?
>
> As the request is the same, I expected to display always the same
> value. Am I'm wrong??
>
> Thank you.
>


What weird behavior are you meaning?

If you request menu.html.bak, that's what your PHP script will see a
request for.

I'm not quite sure I understand exactly what you expect to happen here.
You make a request for '/menu.html'. Are you then saying you randomly
get given back different output from your PHP? In the above examples,
filename has no context, as you're not doing anything with any files in
your PHP script.

Thanks,
Ash
http://www.ashleysheridan.co.uk



--=-HL04gYWYRoMgdria0YVD--
Ashley Sheridan [ Fr, 26 Februar 2010 11:05 ] [ ID #2033546 ]
PHP » gmane.comp.php.general » weird behavior: Apache mod rewrite

Vorheriges Thema: header function query
Nächstes Thema: $_POST vs $_REQUEST