Forum Moderators: phranque

Message Too Old, No Replies

mod rewrite help in Wordpress permalink situation

basic questions about wordpress and htaccess

         

Minuteman

8:01 pm on Feb 21, 2010 (gmt 0)

10+ Year Member



I've been struggling with this for a couple of days now. The immersion in htaccess and mod rewrite has been constructive but I am at a roadblock. I don't know enough about either htaccess or Wordpress to be able to tell which one is messing me up. I have htaccess code that works to a point, then crashes, and I'm suspecting Wordpress is doing something internally despite the htaccess directives. My suspicion is that wordpress is taking my rewritten url that looks like this www.mysite.com/?page_id=3/4/5/6/7 and changing it from inside the php code.

Basically, I have a plugin that works fine in WP under the default permalink setting but breaks with selecting any of the others. I need WP to leave this one page alone so it will work regardless what permalink system they choose for the rest of the site.

In the Wordpress codex, within pages of instruction about htaccess, buried in the middle somewhere, is the line
in WordPress 2.0+ versions, you'll probably need to do this only once (sic writing to the actual htaccess file), because WordPress does the rewriting internally. If you ever move your WordPress home directory (Blog address), you'll need to repeat this step.


I'm running 2.92 so that does apply to me but nowhere does it mention where, how, or how to modify the "rewriting internally" behavior if one needs to. My hunch is that it is the wp-includes/canonical.php file but not sure. Does anyone have any experience along these lines that can tell me if that is what is happening?

Thanks,

Robert

Trav

8:22 pm on Feb 23, 2010 (gmt 0)

10+ Year Member



I'm not even sure if this relates to your problem, but having just updated an install to 2.9.2, I would ask, what permissions/owners do you have going on your .htaccess? If WP needs to write to the file, the permissions have to be set as such. I believe they mention this somewhere near the text that you quoted above.

Minuteman

9:30 pm on Feb 23, 2010 (gmt 0)

10+ Year Member



Hi Trav,

I finally did find the answer and WordPress does, indeed, do BOTH htaccess (mod rewrite) AND internal rewrites. I'm new to the whole rewrite area but the way they do that seems really odd to me and redundant.

Since mod rewrite creates an entirely new file reference internally then why, after it does, then send it to an internal script to rewrite it all over again?

That is basically what it was doing.

Finally someone gave me this little gem ... remove_filter('template_redirect', 'redirect_canonical');

and the problem was solved. That turns off ALL the internal rewrites and leaves the plugin's url alone