Re: mod_rewrite problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Just got a response from the developer of the PHP script (serendipity). Turns out the problem lies there, and not with the rewrite rule. Apparently what's going on is that the php script uses the REQUEST_URI to determine what to display. If it doesn't recognize the REQUEST_URI (as is the case with /nagios) it just displays the main page. It would appear that while mod_rewrite successfully rewrites the URL and calls the PHP script, it doesn't actually change the REQUEST_URI, so the script is still acting on /nagios, which it doesn't recognize. I'll admit this is somewhat beyond me at the moment, perhaps I need to look more into the difference between the REQUEST_URI that the php script is seeing and what, exactly, mod_rewrite is changing. At any rate, that at least explains the problem.



On Mar 7, 2007, at 3:38 PM, Vincent Bray wrote:

[snip]
What's also changed and also puzzling is there's now two steps where
there was just one.


yeah, sorry. That was one of the things I was experimenting with. Since I knew the later rewrite rule worked as intended, I thought I'd try just rewriting /nagios into what the second rule was designed to match. Kind of a kludgy grasping at straws solution that didn't help anyway. The line that I am actually running is back with the index.php? section, I just copied and pasted the wrong code block.


[snip]

However, the first [L] should cause the second rule to not be reached,
assuming that the [R] isn't meant to be there as you pointed out in
the OP.

... And the last three rules shouldn't do anything (but let's let that drop).

Interesting point. However, as these rules were added by serendipity and not me, and don't affect anything anyway, I'm not too concerned :)

[snip]

This looks like a general case of mod_rewrite overuse. It's often a
better idea to use a blanket rewrite with exceptions for static files
and then let the application split the url from the environment. But
that's not your problem :)


yep :) Actually, the original rule set did have a blanket anything.html => index.php?url=$1 rule, but as that made it so I couldn't access the non-serendipity directories on my server (trying, for example, http://izzy.homeip.net/Alaska/Alaska.html, which is an actual page, just wound up back at the home page), I removed it. Thinking about it though, a more elegant solution might be to put that rewrite rule back in by itself, and then use a RewriteEngine Off directive in my other directories to override it, or some such solution. It bears consideration.

[snip]

Just an aside, don't mix relative and absolute Options. That directive
does what you probably think it should but it wouldn't if -Indexes
weren't the first argument and besides:
Options FollowSymLinks MultiViews
has the same effect and requires less typing.

well, it WOULD have the same effect, but for some reason Options Indexes is the default for the / directory, so if I don't override it for my other directories it generates an index page if you request a directory without an index file, which I don't want. I suppose a better option would be to simply remove the Options Indexes from the root level Directory block :)


[snip]

Hrmph, I don't seem to be really helping much. About the script, php
is a pretty brute-force and ignorance kind of environment so just
adding:
phpinfo(); die();
to the start of the script after the opening <?php tag will show you
what's getting passed in, just in case the problem is with the app.

which does appear to be the case, as per the developer response. Thanks for the thoughts!


--
noodl
PS. I'm about to pass out for a few hours, good luck : )
-----------------------------------------------
Israel Brewster
Computer Support Technician
Frontier Flying Service Inc.
5245 Airport Industrial Rd
Fairbanks, AK 99709
(907) 450-7250 x293
-----------------------------------------------


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux