[wp-hackers] weird permalink issue

Steve Taylor steve at sltaylor.co.uk
Wed Mar 30 14:33:29 UTC 2011


I thought I'd tracked this down to wp_old_slug_redirect, because the
redirect occurring seems to be a 301 - and this is the only 301
redirect I can find in the core.

However, this function just returns when it guesses that it's a page
being requested, and it doesn't deal with hierarchical post types.

I'm stuck. Anyone?

cheers,

Steve


On 30 March 2011 14:54, Steve Taylor <steve at sltaylor.co.uk> wrote:
> OK, an update to this. It seems that my "dynamic pages" system is
> being scuppered any time the URL contains a slug that appears anywhere
> in a real page or post elsewhere on the site. WP just redirects to the
> real page or post.
>
> My stuff is happening on the init hook - this code is being processed
> on these requests. I do stuff like changing the HTTP headers to 200
> later, in template_redirect - this code doesn't get processed.
>
> Presumably WP's rewriting / redirecting happens in between. What's the
> easiest way, in the init hook, to say to WP: "don't bother with the
> redirecting on this one"?
>
> I know there's probably better ways of doing what I'm doing, but (1)
> it's been working so far, and (2) if WP is stepping in and not finding
> a real page for the request, shouldn't it be giving a 404? I guess
> it's some interference between my code and WP. Anyway, any ideas about
> halting WP's actions would be great. I'm hammering through the hooks
> now...
>
> cheers,
>
> Steve
>
> On 30 March 2011 14:12, Steve Taylor <steve at sltaylor.co.uk> wrote:
>> Hi there,
>>
>> I've just solved some hideous performance issues on a client's site
>> that turned out to be because of this:
>>
>> http://ottopress.com/2010/category-in-permalinks-considered-harmful/
>>
>> The permalink for posts was:
>>
>> /%category%/news%/%postname%/
>>
>> It's now:
>>
>> /%year%/%category%/news/%postname%/
>>
>> And things are much better :)
>>
>> Apart from one item of weirdness. A particular URL:
>>
>> http://www.integer-research.com/conferences/dec-brazil/2011/delegates/
>>
>> Now redirects to:
>>
>> http://www.integer-research.com/2010/fertilizers-chemicals/news/delegates-predict-world-cup-winner/
>>
>> Actually, every /delegates/ page on every conference redirects there.
>>
>> Now, that first URL isn't really a page. The system I've built
>> intercepts that 404 and serves up a dynamic template. I guess the
>> rewriting must be finding no page from the database and doing some
>> kind of leap of imagination to the post above.
>>
>> The "fix" I've done for now is the change the slug for this "dynamic URL" to:
>>
>> http://www.integer-research.com/conferences/dec-brazil/2011/the-delegates/
>>
>> Works fine.
>>
>> There are other "dynamic URL" pages that still work fine.
>>
>> I guess I could create an actual page at that location, but the whole
>> point of these dynamic pages is that when the client creates a new
>> conference, some bits, like the delegates list, happen automatically -
>> it doesn't rely on them remembering to create them.
>>
>> Just wondered if anyone else had had issues with clashes like this
>> with permalink structures, and if there's any other workarounds.
>>
>> cheers,
>>
>> Steve
>>
>


More information about the wp-hackers mailing list