[wp-hackers] Rewrite Experiment

Mark Jaquith mark.wordpress at txfx.net
Sun Sep 19 03:55:37 UTC 2004


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.
>>
>>
>> On Sat, 18 Sep 2004 02:49:15 -0500, Ryan Boren <ryan at boren.nu> wrote:
>>  
>>
>>> On Sat, 2004-09-18 at 02:41 -0500, Ryan Boren wrote:
>>>   
>>>
>>>> Get rid of all of your rewrite rules and replace them with this:
>>>>
>>>> RewriteEngine On
>>>> RewriteBase /
>>>> RewriteCond %{REQUEST_FILENAME} !-f
>>>> RewriteRule ^(.+)$ /index.php/$1
>>>>
>>>> Adjust your base accordingly.  If you're running from a subdir, let's
>>>> say "wordpress", you'll need:
>>>>
>>>> RewriteEngine On
>>>> RewriteBase /wordpress/
>>>> RewriteCond %{REQUEST_FILENAME} !-f
>>>> RewriteRule ^(.+)$ /wordpress/index.php/$1
>>>>
>>>> Does it work?
>>>>     
>>>
>>> Oops.  I sent the wrong version.  That one is missing the -d test. Try
>>> this:
>>>
>>> RewriteEngine On
>>> RewriteBase /
>>> RewriteCond %{REQUEST_FILENAME} !-f
>>> RewriteCond %{REQUEST_FILENAME} !-d
>>> RewriteRule ^(.+)$ /index.php/$1
>>>
>>>
>>>
>>>
>>> Ryan
>>>
>>> _______________________________________________
>>> hackers mailing list
>>> hackers at wordpress.org
>>> http://wordpress.org/mailman/listinfo/hackers_wordpress.org
>>>
>>>   
>>
>>
>>
>>
>>  
>>
>
>
> _______________________________________________
> hackers mailing list
> hackers at wordpress.org
> http://wordpress.org/mailman/listinfo/hackers_wordpress.org
>
>
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.



More information about the hackers mailing list