View previous topic :: View next topic |
Author |
Message |
morgajel n00b
Joined: 17 Jan 2005 Posts: 24 Location: Grand Rapids, MI
|
Posted: Mon Nov 28, 2005 9:04 pm Post subject: mod_rewrite allows explicit but not implicit rewrites |
|
|
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 |
|
|
synt4x n00b
Joined: 20 Jun 2005 Posts: 46
|
Posted: Mon Nov 28, 2005 10:23 pm Post subject: |
|
|
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 |
|
|
Hagar Guru
Joined: 11 Feb 2003 Posts: 445
|
Posted: Mon Nov 28, 2005 10:30 pm Post subject: |
|
|
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 |
|
|
morgajel n00b
Joined: 17 Jan 2005 Posts: 24 Location: Grand Rapids, MI
|
Posted: Tue Nov 29, 2005 1:08 am Post subject: |
|
|
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 |
|
|
Hagar Guru
Joined: 11 Feb 2003 Posts: 445
|
Posted: Tue Nov 29, 2005 2:19 am Post subject: |
|
|
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 |
|
|
morgajel n00b
Joined: 17 Jan 2005 Posts: 24 Location: Grand Rapids, MI
|
Posted: Tue Nov 29, 2005 11:43 am Post subject: |
|
|
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 |
|
|
morgajel n00b
Joined: 17 Jan 2005 Posts: 24 Location: Grand Rapids, MI
|
Posted: Wed Nov 30, 2005 2:59 pm Post subject: |
|
|
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 |
|
|
|