[wp-hackers] Rewrite Experiment

Ryan Boren ryan at boren.nu
Sun Sep 19 04:30:54 UTC 2004


On Sat, 2004-09-18 at 23:55 -0400, Mark Jaquith wrote:
> Sebastian Herp wrote:
> 
> > I think we/you should pay attention to _this_ issue. I like my 404s 
> > and as Arthur wrote, we will not have any 404s again, if we use these 
> > Rewrite-rules :-(
> >
> > How does the index.php react if it is given a path for something which 
> > does not exist in its database?
> >
> > Arthur Jennings wrote:
> >
> >> I used to to use ascheme like that when I was running Blosxom. One
> >> problem with it was that *everything* goes to index.php -- you can't
> >> tell if there are 404s (unless there's some way for wp to generate
> >> 404s.
> >
> I wouldn't worry about this too much.  We can change the "universal" 
> mod_rewrite rule so that it only sends to Wordpress URIs that are WP 
> related.  For example: if a URI starts with a four digit year, the word 
> "category" (or whatever the category base is), "feed," "author," etc, 
> then we know it is definitely a WP URI.  If the URI starts with 
> something random that isn't a WP URI, it'll still generate a 404.


The problem is that /index.php/archives/random-stuff/here/ will not
produce a 404 without special care.  Luckily, if wp-blog-header goes
into path info matching mode and doesn't find a match, it emits a 404
header and sets is_404() to be true.  If the theme provides a 404.php
file, that is loaded.  Or, the template author can add an "if (is_404
())" case in their index.php.

404s in the server logs is a different matter.

Ryan





More information about the hackers mailing list