Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
mod_rewrite allows explicit but not implicit rewrites
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
morgajel
n00b
n00b


Joined: 17 Jan 2005
Posts: 24
Location: Grand Rapids, MI

PostPosted: Mon Nov 28, 2005 9:04 pm    Post subject: mod_rewrite allows explicit but not implicit rewrites Reply with quote

at some point between november 10th and 19th, I updated something that borked my wordpress installation. we've tracked it down to mod rewrite not working properly.

suppose you have the following page:

http://morgajel.net/p/28

now, mod rewrite is *supposed* to show the content of
http://morgajel.net?p=28

but instead displays a blank page. We played around a bit and found if we made it an explicit forward, it works- i.e.
http://morgajel.net/p2/28

will automagically change to
http://morgajel.net?p=28
and work properly.

The .htaccess file we're using to control all of this looks like this:
Code:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^p2/(\d+)/?$ /?p=$1 [R=301]
RewriteRule ^p/(\d+)/?$ /?p=$1
RewriteRule ^p3/(\d+)/?$ /?p=$1 [NS]
</IfModule>


Now, I admit, I know very little about mod_rewrite, but I think even THIS behavior is unusual for it.
I've tried recompiling apache, to no avail, and I'm not sure what else there is to do. Also worth noting is that there is nothing unusual in the apache logs or mod_rewrite logs(when I enable them)

Anyone have any ideas what would cause this goofiness? mod_rewrite is obviously working since it rewrites for p2 properly.
Back to top
View user's profile Send private message
synt4x
n00b
n00b


Joined: 20 Jun 2005
Posts: 46

PostPosted: Mon Nov 28, 2005 10:23 pm    Post subject: Reply with quote

Try using a full path when not doing an external redirect. mod_rewrite probably doesn't call upon mod_autoindex to think that the file '/' could be index.php (or whatever you specify in httpd.conf). It's also possible that you want to supply a relative path instead of an absolute one.

If all else files, use the 'RewriteLogLevel X' directive -- setting X to 5 usually does the charm to help me diagnose things.
Back to top
View user's profile Send private message
Hagar
Guru
Guru


Joined: 11 Feb 2003
Posts: 445

PostPosted: Mon Nov 28, 2005 10:30 pm    Post subject: Reply with quote

Do you have a file named p.<extension> or a directory named p in the webroot?
In that case it might be multiviews that's kicking in before mod_rewrite.
Add this to your .htaccess and try again.

Options -Multiviews

@synt4x: it does, mod_rewrite rewrites the url and then passes it on to the next module.
Back to top
View user's profile Send private message
morgajel
n00b
n00b


Joined: 17 Jan 2005
Posts: 24
Location: Grand Rapids, MI

PostPosted: Tue Nov 29, 2005 1:08 am    Post subject: Reply with quote

synt4x
it's unusual because it was working less than a month ago. Oh, and I drilled down all the way to level 9, but again, it's not very helpful.

Hagar
no p.* files, and adding Options -Multiview to both the virtualhost stanza AND to the htaccess block did not help.
Back to top
View user's profile Send private message
Hagar
Guru
Guru


Joined: 11 Feb 2003
Posts: 445

PostPosted: Tue Nov 29, 2005 2:19 am    Post subject: Reply with quote

Yeah, that is unusual :)
Did you modify/upgrade wordpress during this period?
Could there be conflicting rules present in the complete set of rules?
Back to top
View user's profile Send private message
morgajel
n00b
n00b


Joined: 17 Jan 2005
Posts: 24
Location: Grand Rapids, MI

PostPosted: Tue Nov 29, 2005 11:43 am    Post subject: Reply with quote

Hagar wrote:
Yeah, that is unusual :)
Did you modify/upgrade wordpress during this period?
Could there be conflicting rules present in the complete set of rules?



I may have upgraded wordpress(not sure, can't remember), but even then it wouldn't cause this problem with mod_rewrite, which we're 99% sure is where the problem lies.
The short list of /p/ and /p2/ were hand crafted- that's all the rewrite rules in the system, so I doubt there's a conflict.
Back to top
View user's profile Send private message
morgajel
n00b
n00b


Joined: 17 Jan 2005
Posts: 24
Location: Grand Rapids, MI

PostPosted: Wed Nov 30, 2005 2:59 pm    Post subject: Reply with quote

AHA!

so it wasn't mod_rewrite after all...

there's something funky with mod_php

I've got the details here:

http://morgajel.net/2005/11/28/29/
I wouldn't mark it as solved, but I'm not 100% sure what to do at this point.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum