httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vincent Bray" <nood...@gmail.com>
Subject Re: [users@httpd] mod_rewrite problem
Date Thu, 08 Mar 2007 00:38:26 GMT
On 08/03/07, Israel Brewster <israel@frontierflying.com> wrote:
> Oh, sure. Sorry- not trying to make things difficult here, it's just
> that I spent several hours yesterday working on the issue, so I'm a
> bit frustrated, and quite possibly not thinking straight any more :P.
> Anyway, the rewrite rules I'm currently working with are as follows:

So far you've moved your initial config:

RewriteEngine On
RewriteBase /
RewriteRule ^nagios[/A-Za-z0-9]* index.php?/categories/8-Nagios [NC,QSA,L]

from a htaccess file to httpd.conf. Was this stuff alone there, with
these other parts in the httpd.conf file, or were they together?
What's also changed and also puzzling is there's now two steps where
there was just one.


> RewriteLog "/var/log/httpd/rewrite.log"
> RewriteLogLevel 2

### here:
> RewriteRule ^/nagios[/A-Za-z0-9]* /categories/8-Nagios [NC,QSA,L,R]
> RewriteRule ^(/archives/([0-9]+)-[0-9a-z\.\_!;,\+\-\%]+\.html) /
> index.php?/$1 [NC,L,QSA]
> RewriteRule ^(/authors/([0-9]+)-[0-9a-z\.\_!;,\+\-\%]+) /index.php?/
> $1 [NC,L,QSA]
> RewriteRule ^(/feeds/categories/([0-9;]+)-[0-9a-z\.\_!;,\+\-\%]+
> \.rss) /index.php?/$1 [NC,L,QSA]
> RewriteRule ^(/feeds/authors/([0-9]+)-[0-9a-z\.\_!;,\+\-\%]+\.rss) /
> index.php?/$1 [NC,L,QSA]

### and then here:
> RewriteRule ^(/categories/([0-9;]+)-[0-9a-z\.\_!;,\+\-\%]+) /
> index.php?/$1 [NC,L,QSA]
> RewriteRule ^/archives([/A-Za-z0-9]+)\.html /index.php?url=/archives/
> $1.html [NC,L,QSA]
> RewriteRule ^(/[0-9]+)[_\-][0-9a-z_\-]*\.html /index.php?url=$1-
> article.html [L,NC,QSA]
> RewriteRule ^/feeds/(.*) /index.php?url=/feeds/$1 [L,QSA]
> RewriteRule ^/unsubscribe/(.*)/([0-9]+) /index.php?url=/unsubscribe/
> $1/$2 [L,QSA]
> RewriteRule ^/approve/(.*)/(.*)/([0-9]+) /index.php?url=approve/$1/$2/
> $3 [L,QSA]
> RewriteRule ^/delete/(.*)/(.*)/([0-9]+) /index.php?url=delete/$1/$2/
> $3 [L,QSA]
> RewriteRule ^(/admin|entries)(/.+)? /index.php?url=admin/ [L,QSA]
> RewriteRule ^/archive/? /index.php?url=/archive [L,QSA]
> RewriteRule ^(/index|atom[0-9]*|rss|b2rss|b2rdf).(rss|rdf|rss2|xml) /
> rss.php?file=$1&ext=$2
> RewriteRule ^(/plugin|plugin)/(.*) /index.php?url=$1/$2 [L,QSA]
> RewriteRule ^/search/(.*) /index.php?url=/search/$1 [L,QSA]
> RewriteRule ^/comments/(.*) /index.php?url=/comments/$1 [L,QSA]
> RewriteRule ^(serendipity\.css|serendipity_admin\.css) index.php?url=/
> $1 [L,QSA]
> RewriteRule ^index\.(html?|php.+) index.php?url=index.html [L,QSA]
> RewriteRule ^htmlarea/(.*) htmlarea/$1 [L,QSA]

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).

> Aside from the nagios one that I added, this is the standard set of
> rules for a serendipity (www.s9y.org) install. I have tried
> commenting out all of them (completely breaking my site, of course)
> except for the nagios one, but I still wind up at the index page when
> I try accessing /nagios. The Directory block for the root directory
> (which this is all running out of) is the following:

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 :)

> <Directory "/WebServer/Documents">
>      Options -Indexes FollowSymLinks MultiViews
>      AllowOverride All
>      Order allow,deny
>      Allow from all
>      RewriteEngine On
> </Directory>

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.

> the rest of my httpd.conf is default, the only other parts I have
> edited being the server name and UseCanonicalName directives.
>
> I could potentially edit the php file, but I really don't know php-
> my programing skills are primarily limited to shell scripting and C+
> + :) Where would I stick that code, or would that depend on the
> script (as I suspect would be the case)? It is the serendipity
> index.php file if you want to download it and take a look. Thank you
> VERY much for your help. I greatly appreciate it :)

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.

-- 
noodl
PS. I'm about to pass out for a few hours, good luck : )

---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message