arantius
asked on
mod_rewrite again
In reference to http://oldlook.experts-exchange.com/questions/21163692/rewrite-mod-rewrite-rules-to-work-with-1-3.html
The solution appeared correct, and did not give any errors, but now that I'm trying to implement it, it's not working.
The rule
RewriteRule ^topic/(.*)/(.*)$ topic.php?blog=$1&topic=$2 [L]
Is turning
/topic/arantius/tech/
into
topic.php?blog=arantius/te ch/arantiu s&topic=te ch/
where of course it should be
topic.php?blog=arantius&to pic=tech
Which isn't quite cutting it! =)
The solution appeared correct, and did not give any errors, but now that I'm trying to implement it, it's not working.
The rule
RewriteRule ^topic/(.*)/(.*)$ topic.php?blog=$1&topic=$2
Is turning
/topic/arantius/tech/
into
topic.php?blog=arantius/te
where of course it should be
topic.php?blog=arantius&to
Which isn't quite cutting it! =)
ASKER
The lack of non-greedy wildcard operators in 1.3 makes that rule not quite work in the big picture. Below is a full set of rules that almost works in 1.3, the problem is the trailing slashes. I want them to be optional, not required. If I put the ? after the / that I used in 2, that matches the / inside the wildcard operator, breaking my site.
RewriteEngine On
RewriteBase /
RewriteRule ^news/archive/(.*)\.(.*)\. html$ news.php?do=archive&feedID =$1&start= $2 [L]
RewriteRule ^news/archive/(.*)\.html$ news.php?do=archive&feedID =$1 [L]
RewriteRule ^news/read/$ news.php?do=read [L]
RewriteRule ^newarticle/(.*)/$ newarticle.php?blog=$1 [L]
RewriteRule ^newarticle/$ / [L,R]
RewriteRule ^comment/(.*)/(.*)/$ comment.php?blog=$1&articl e=$2 [L]
RewriteRule ^comment/(.*)/$ /blog/$1/ [L,R]
RewriteRule ^comment/$ / [L,R]
RewriteRule ^article/(.*)/(.*)/$ article.php?blog=$1&articl e=$2 [L]
RewriteRule ^article/(.*)/$ /blog/$1/ [L,R]
RewriteRule ^article/$ / [L,R]
RewriteRule ^archive/(.*)/(.*)/$ /archive.php?blog=$1&start =$2 [L]
RewriteRule ^archive/(.*)/$ /archive.php?blog=$1 [L]
RewriteRule ^archive/$ / [L,R]
RewriteRule ^stumble/(.*)/(.*)/$ /stumble.php?blog=$1&start =$2 [L]
RewriteRule ^stumble/(.*)/$ /stumble.php?blog=$1 [L]
RewriteRule ^stumble/$ / [L,R]
RewriteRule ^games/game\.(.*)\.html$ /games/index.php?gameID=$1 [L]
RewriteRule ^games/game-(.+)/$ /games/index.php?gameID=$1 [L]
RewriteRule ^topic/(.+)/(.+)/$ topic.php?blog=$1&topic=$2 [L]
RewriteRule ^topic/(.+)/$ /topic.php?blog=$1 [L]
RewriteRule ^topic/$ topic.php [L]
RewriteRule ^blog/(.+)/?$ blog.php?blog=$1 [L]
RewriteRule ^blog/?$ / [L,R]
RewriteEngine On
RewriteBase /
RewriteRule ^news/archive/(.*)\.(.*)\.
RewriteRule ^news/archive/(.*)\.html$ news.php?do=archive&feedID
RewriteRule ^news/read/$ news.php?do=read [L]
RewriteRule ^newarticle/(.*)/$ newarticle.php?blog=$1 [L]
RewriteRule ^newarticle/$ / [L,R]
RewriteRule ^comment/(.*)/(.*)/$ comment.php?blog=$1&articl
RewriteRule ^comment/(.*)/$ /blog/$1/ [L,R]
RewriteRule ^comment/$ / [L,R]
RewriteRule ^article/(.*)/(.*)/$ article.php?blog=$1&articl
RewriteRule ^article/(.*)/$ /blog/$1/ [L,R]
RewriteRule ^article/$ / [L,R]
RewriteRule ^archive/(.*)/(.*)/$ /archive.php?blog=$1&start
RewriteRule ^archive/(.*)/$ /archive.php?blog=$1 [L]
RewriteRule ^archive/$ / [L,R]
RewriteRule ^stumble/(.*)/(.*)/$ /stumble.php?blog=$1&start
RewriteRule ^stumble/(.*)/$ /stumble.php?blog=$1 [L]
RewriteRule ^stumble/$ / [L,R]
RewriteRule ^games/game\.(.*)\.html$ /games/index.php?gameID=$1
RewriteRule ^games/game-(.+)/$ /games/index.php?gameID=$1
RewriteRule ^topic/(.+)/(.+)/$ topic.php?blog=$1&topic=$2
RewriteRule ^topic/(.+)/$ /topic.php?blog=$1 [L]
RewriteRule ^topic/$ topic.php [L]
RewriteRule ^blog/(.+)/?$ blog.php?blog=$1 [L]
RewriteRule ^blog/?$ / [L,R]
Insert the foolowing rule in the beginning
RewriteRule ^(.*)/$ $1
this will remove the trailing slashes. Dont forget to remove the trailing slashes from the other rules.
david
RewriteRule ^(.*)/$ $1
this will remove the trailing slashes. Dont forget to remove the trailing slashes from the other rules.
david
ASKER
It doesn't quite remove the trailing slashes, it causes major problems.
With just the rules:
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)/$ $1
RewriteRule ^topic/(.+)/(.+)$ topic.php?blog=$1&topic=$2 [L]
RewriteRule ^topic/(.+)$ /topic.php?blog=$1 [L]
RewriteRule ^topic$ topic.php [L]
It sends /topic/arantius/ to /topic.php?blog=arantius&t opic=arant ius/
And /topic/arantius/general/ to /topic.php?blog=arantius/g eneral/ara ntius&topi c=general/
The log shows:
66.199.132.173 - - [13/Oct/2004:13:34:12 -0400] [www.arantius.com/sid#81d4744][rid#812ffe4/initial] (3) [per-dir /home/arantius/public_html /] add path-info postfix: /home/arantius/public_html /topic -> /home/arantius/public_html /topic/ara ntius/gene ral/
66.199.132.173 - - [13/Oct/2004:13:34:12 -0400] [www.arantius.com/sid#81d4744][rid#812ffe4/initial] (3) [per-dir /home/arantius/public_html /] strip per-dir prefix: /home/arantius/public_html /topic/ara ntius/gene ral/ -> topic/arantius/general/
66.199.132.173 - - [13/Oct/2004:13:34:12 -0400] [www.arantius.com/sid#81d4744][rid#812ffe4/initial] (3) [per-dir /home/arantius/public_html /] applying pattern '^(.*)/$' to uri 'topic/arantius/general/'
66.199.132.173 - - [13/Oct/2004:13:34:12 -0400] [www.arantius.com/sid#81d4744][rid#812ffe4/initial] (2) [per-dir /home/arantius/public_html /] rewrite topic/arantius/general/ -> topic/arantius/general
66.199.132.173 - - [13/Oct/2004:13:34:12 -0400] [www.arantius.com/sid#81d4744][rid#812ffe4/initial] (3) [per-dir /home/arantius/public_html /] add per-dir prefix: topic/arantius/general -> /home/arantius/public_html /topic/ara ntius/gene ral
66.199.132.173 - - [13/Oct/2004:13:34:12 -0400] [www.arantius.com/sid#81d4744][rid#812ffe4/initial] (3) [per-dir /home/arantius/public_html /] add path-info postfix: /home/arantius/public_html /topic/ara ntius/gene ral -> /home/arantius/public_html /topic/ara ntius/gene ral/aranti us/general /
66.199.132.173 - - [13/Oct/2004:13:34:12 -0400] [www.arantius.com/sid#81d4744][rid#812ffe4/initial] (3) [per-dir /home/arantius/public_html /] strip per-dir prefix: /home/arantius/public_html /topic/ara ntius/gene ral/aranti us/general / -> topic/arantius/general/ara ntius/gene ral/
66.199.132.173 - - [13/Oct/2004:13:34:12 -0400] [www.arantius.com/sid#81d4744][rid#812ffe4/initial] (3) [per-dir /home/arantius/public_html /] applying pattern '^topic/(.+)/(.+)$' to uri 'topic/arantius/general/ar antius/gen eral/'
66.199.132.173 - - [13/Oct/2004:13:34:12 -0400] [www.arantius.com/sid#81d4744][rid#812ffe4/initial] (2) [per-dir /home/arantius/public_html /] rewrite topic/arantius/general/ara ntius/gene ral/ -> /topic.php?blog=arantius/g eneral/ara ntius&topi c=general/
66.199.132.173 - - [13/Oct/2004:13:34:12 -0400] [www.arantius.com/sid#81d4744][rid#812ffe4/initial] (3) split uri=/topic.php?blog=aranti us/general /arantius& topic=gene ral/ -> uri=/topic.php, args=blog=arantius/general /arantius& topic=gene ral/
66.199.132.173 - - [13/Oct/2004:13:34:12 -0400] [www.arantius.com/sid#81d4744][rid#812ffe4/initial] (2) [per-dir /home/arantius/public_html /] trying to replace prefix /home/arantius/public_html / with /
66.199.132.173 - - [13/Oct/2004:13:34:12 -0400] [www.arantius.com/sid#81d4744][rid#812ffe4/initial] (1) [per-dir /home/arantius/public_html /] internal redirect with /topic.php [INTERNAL REDIRECT]
66.199.132.173 - - [13/Oct/2004:13:34:12 -0400] [www.arantius.com/sid#81d4744][rid#8121174/initial/red ir#1] (3) [per-dir /home/arantius/public_html /] strip per-dir prefix: /home/arantius/public_html /topic.php -> topic.php
66.199.132.173 - - [13/Oct/2004:13:34:12 -0400] [www.arantius.com/sid#81d4744][rid#8121174/initial/red ir#1] (3) [per-dir /home/arantius/public_html /] applying pattern '^(.*)/$' to uri 'topic.php'
66.199.132.173 - - [13/Oct/2004:13:34:12 -0400] [www.arantius.com/sid#81d4744][rid#8121174/initial/red ir#1] (3) [per-dir /home/arantius/public_html /] strip per-dir prefix: /home/arantius/public_html /topic.php -> topic.php
66.199.132.173 - - [13/Oct/2004:13:34:12 -0400] [www.arantius.com/sid#81d4744][rid#8121174/initial/red ir#1] (3) [per-dir /home/arantius/public_html /] applying pattern '^topic/(.+)/(.+)$' to uri 'topic.php'
66.199.132.173 - - [13/Oct/2004:13:34:12 -0400] [www.arantius.com/sid#81d4744][rid#8121174/initial/red ir#1] (3) [per-dir /home/arantius/public_html /] strip per-dir prefix: /home/arantius/public_html /topic.php -> topic.php
66.199.132.173 - - [13/Oct/2004:13:34:12 -0400] [www.arantius.com/sid#81d4744][rid#8121174/initial/red ir#1] (3) [per-dir /home/arantius/public_html /] applying pattern '^topic/(.+)$' to uri 'topic.php'
66.199.132.173 - - [13/Oct/2004:13:34:12 -0400] [www.arantius.com/sid#81d4744][rid#8121174/initial/red ir#1] (3) [per-dir /home/arantius/public_html /] strip per-dir prefix: /home/arantius/public_html /topic.php -> topic.php
66.199.132.173 - - [13/Oct/2004:13:34:12 -0400] [www.arantius.com/sid#81d4744][rid#8121174/initial/red ir#1] (3) [per-dir /home/arantius/public_html /] applying pattern '^topic$' to uri 'topic.php'
66.199.132.173 - - [13/Oct/2004:13:34:12 -0400] [www.arantius.com/sid#81d4744][rid#8121174/initial/red ir#1] (1) [per-dir /home/arantius/public_html /] pass through /home/arantius/public_html /topic.php
Without the rule you suggested, the log is:
66.199.132.173 - - [13/Oct/2004:13:36:00 -0400] [www.arantius.com/sid#81d4744][rid#812ffe4/initial] (3) [per-dir /home/arantius/public_html /] add path-info postfix: /home/arantius/public_html /topic -> /home/arantius/public_html /topic/ara ntius/gene ral/
66.199.132.173 - - [13/Oct/2004:13:36:00 -0400] [www.arantius.com/sid#81d4744][rid#812ffe4/initial] (3) [per-dir /home/arantius/public_html /] strip per-dir prefix: /home/arantius/public_html /topic/ara ntius/gene ral/ -> topic/arantius/general/
66.199.132.173 - - [13/Oct/2004:13:36:00 -0400] [www.arantius.com/sid#81d4744][rid#812ffe4/initial] (3) [per-dir /home/arantius/public_html /] applying pattern '^topic/(.+)/(.+)$' to uri 'topic/arantius/general/'
66.199.132.173 - - [13/Oct/2004:13:36:00 -0400] [www.arantius.com/sid#81d4744][rid#812ffe4/initial] (2) [per-dir /home/arantius/public_html /] rewrite topic/arantius/general/ -> /topic.php?blog=arantius&t opic=gener al/
66.199.132.173 - - [13/Oct/2004:13:36:00 -0400] [www.arantius.com/sid#81d4744][rid#812ffe4/initial] (3) split uri=/topic.php?blog=aranti us&topic=g eneral/ -> uri=/topic.php, args=blog=arantius&topic=g eneral/
66.199.132.173 - - [13/Oct/2004:13:36:00 -0400] [www.arantius.com/sid#81d4744][rid#812ffe4/initial] (2) [per-dir /home/arantius/public_html /] trying to replace prefix /home/arantius/public_html / with /
66.199.132.173 - - [13/Oct/2004:13:36:00 -0400] [www.arantius.com/sid#81d4744][rid#812ffe4/initial] (1) [per-dir /home/arantius/public_html /] internal redirect with /topic.php [INTERNAL REDIRECT]
66.199.132.173 - - [13/Oct/2004:13:36:00 -0400] [www.arantius.com/sid#81d4744][rid#8120e14/initial/red ir#1] (3) [per-dir /home/arantius/public_html /] strip per-dir prefix: /home/arantius/public_html /topic.php -> topic.php
66.199.132.173 - - [13/Oct/2004:13:36:00 -0400] [www.arantius.com/sid#81d4744][rid#8120e14/initial/red ir#1] (3) [per-dir /home/arantius/public_html /] applying pattern '^topic/(.+)/(.+)$' to uri 'topic.php'
66.199.132.173 - - [13/Oct/2004:13:36:00 -0400] [www.arantius.com/sid#81d4744][rid#8120e14/initial/red ir#1] (3) [per-dir /home/arantius/public_html /] strip per-dir prefix: /home/arantius/public_html /topic.php -> topic.php
66.199.132.173 - - [13/Oct/2004:13:36:00 -0400] [www.arantius.com/sid#81d4744][rid#8120e14/initial/red ir#1] (3) [per-dir /home/arantius/public_html /] applying pattern '^topic/(.+)$' to uri 'topic.php'
66.199.132.173 - - [13/Oct/2004:13:36:00 -0400] [www.arantius.com/sid#81d4744][rid#8120e14/initial/red ir#1] (3) [per-dir /home/arantius/public_html /] strip per-dir prefix: /home/arantius/public_html /topic.php -> topic.php
66.199.132.173 - - [13/Oct/2004:13:36:00 -0400] [www.arantius.com/sid#81d4744][rid#8120e14/initial/red ir#1] (3) [per-dir /home/arantius/public_html /] applying pattern '^topic$' to uri 'topic.php'
66.199.132.173 - - [13/Oct/2004:13:36:00 -0400] [www.arantius.com/sid#81d4744][rid#8120e14/initial/red ir#1] (1) [per-dir /home/arantius/public_html /] pass through /home/arantius/public_html /topic.php
With just the rules:
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)/$ $1
RewriteRule ^topic/(.+)/(.+)$ topic.php?blog=$1&topic=$2
RewriteRule ^topic/(.+)$ /topic.php?blog=$1 [L]
RewriteRule ^topic$ topic.php [L]
It sends /topic/arantius/ to /topic.php?blog=arantius&t
And /topic/arantius/general/ to /topic.php?blog=arantius/g
The log shows:
66.199.132.173 - - [13/Oct/2004:13:34:12 -0400] [www.arantius.com/sid#81d4744][rid#812ffe4/initial] (3) [per-dir /home/arantius/public_html
66.199.132.173 - - [13/Oct/2004:13:34:12 -0400] [www.arantius.com/sid#81d4744][rid#812ffe4/initial] (3) [per-dir /home/arantius/public_html
66.199.132.173 - - [13/Oct/2004:13:34:12 -0400] [www.arantius.com/sid#81d4744][rid#812ffe4/initial] (3) [per-dir /home/arantius/public_html
66.199.132.173 - - [13/Oct/2004:13:34:12 -0400] [www.arantius.com/sid#81d4744][rid#812ffe4/initial] (2) [per-dir /home/arantius/public_html
66.199.132.173 - - [13/Oct/2004:13:34:12 -0400] [www.arantius.com/sid#81d4744][rid#812ffe4/initial] (3) [per-dir /home/arantius/public_html
66.199.132.173 - - [13/Oct/2004:13:34:12 -0400] [www.arantius.com/sid#81d4744][rid#812ffe4/initial] (3) [per-dir /home/arantius/public_html
66.199.132.173 - - [13/Oct/2004:13:34:12 -0400] [www.arantius.com/sid#81d4744][rid#812ffe4/initial] (3) [per-dir /home/arantius/public_html
66.199.132.173 - - [13/Oct/2004:13:34:12 -0400] [www.arantius.com/sid#81d4744][rid#812ffe4/initial] (3) [per-dir /home/arantius/public_html
66.199.132.173 - - [13/Oct/2004:13:34:12 -0400] [www.arantius.com/sid#81d4744][rid#812ffe4/initial] (2) [per-dir /home/arantius/public_html
66.199.132.173 - - [13/Oct/2004:13:34:12 -0400] [www.arantius.com/sid#81d4744][rid#812ffe4/initial] (3) split uri=/topic.php?blog=aranti
66.199.132.173 - - [13/Oct/2004:13:34:12 -0400] [www.arantius.com/sid#81d4744][rid#812ffe4/initial] (2) [per-dir /home/arantius/public_html
66.199.132.173 - - [13/Oct/2004:13:34:12 -0400] [www.arantius.com/sid#81d4744][rid#812ffe4/initial] (1) [per-dir /home/arantius/public_html
66.199.132.173 - - [13/Oct/2004:13:34:12 -0400] [www.arantius.com/sid#81d4744][rid#8121174/initial/red
66.199.132.173 - - [13/Oct/2004:13:34:12 -0400] [www.arantius.com/sid#81d4744][rid#8121174/initial/red
66.199.132.173 - - [13/Oct/2004:13:34:12 -0400] [www.arantius.com/sid#81d4744][rid#8121174/initial/red
66.199.132.173 - - [13/Oct/2004:13:34:12 -0400] [www.arantius.com/sid#81d4744][rid#8121174/initial/red
66.199.132.173 - - [13/Oct/2004:13:34:12 -0400] [www.arantius.com/sid#81d4744][rid#8121174/initial/red
66.199.132.173 - - [13/Oct/2004:13:34:12 -0400] [www.arantius.com/sid#81d4744][rid#8121174/initial/red
66.199.132.173 - - [13/Oct/2004:13:34:12 -0400] [www.arantius.com/sid#81d4744][rid#8121174/initial/red
66.199.132.173 - - [13/Oct/2004:13:34:12 -0400] [www.arantius.com/sid#81d4744][rid#8121174/initial/red
66.199.132.173 - - [13/Oct/2004:13:34:12 -0400] [www.arantius.com/sid#81d4744][rid#8121174/initial/red
Without the rule you suggested, the log is:
66.199.132.173 - - [13/Oct/2004:13:36:00 -0400] [www.arantius.com/sid#81d4744][rid#812ffe4/initial] (3) [per-dir /home/arantius/public_html
66.199.132.173 - - [13/Oct/2004:13:36:00 -0400] [www.arantius.com/sid#81d4744][rid#812ffe4/initial] (3) [per-dir /home/arantius/public_html
66.199.132.173 - - [13/Oct/2004:13:36:00 -0400] [www.arantius.com/sid#81d4744][rid#812ffe4/initial] (3) [per-dir /home/arantius/public_html
66.199.132.173 - - [13/Oct/2004:13:36:00 -0400] [www.arantius.com/sid#81d4744][rid#812ffe4/initial] (2) [per-dir /home/arantius/public_html
66.199.132.173 - - [13/Oct/2004:13:36:00 -0400] [www.arantius.com/sid#81d4744][rid#812ffe4/initial] (3) split uri=/topic.php?blog=aranti
66.199.132.173 - - [13/Oct/2004:13:36:00 -0400] [www.arantius.com/sid#81d4744][rid#812ffe4/initial] (2) [per-dir /home/arantius/public_html
66.199.132.173 - - [13/Oct/2004:13:36:00 -0400] [www.arantius.com/sid#81d4744][rid#812ffe4/initial] (1) [per-dir /home/arantius/public_html
66.199.132.173 - - [13/Oct/2004:13:36:00 -0400] [www.arantius.com/sid#81d4744][rid#8120e14/initial/red
66.199.132.173 - - [13/Oct/2004:13:36:00 -0400] [www.arantius.com/sid#81d4744][rid#8120e14/initial/red
66.199.132.173 - - [13/Oct/2004:13:36:00 -0400] [www.arantius.com/sid#81d4744][rid#8120e14/initial/red
66.199.132.173 - - [13/Oct/2004:13:36:00 -0400] [www.arantius.com/sid#81d4744][rid#8120e14/initial/red
66.199.132.173 - - [13/Oct/2004:13:36:00 -0400] [www.arantius.com/sid#81d4744][rid#8120e14/initial/red
66.199.132.173 - - [13/Oct/2004:13:36:00 -0400] [www.arantius.com/sid#81d4744][rid#8120e14/initial/red
66.199.132.173 - - [13/Oct/2004:13:36:00 -0400] [www.arantius.com/sid#81d4744][rid#8120e14/initial/red
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ah yes, the pseudo-non-greedy character class inversion .. might well work. I'll get back to you.
ASKER
Everything finally works right, thank you! For interested parties, the final set of rules ended up being:
ErrorDocument 404 /404
RewriteEngine On
RewriteBase /
RewriteRule ^news/archive/(.*)\.(.*)\. html$ /news.php?do=archive&feedI D=$1&start =$2 [L]
RewriteRule ^news/archive/(.*)\.html$ /news.php?do=archive&feedI D=$1 [L]
RewriteRule ^news/read/?$ /news.php?do=read [L]
RewriteRule ^news/?$ /news.php [L]
RewriteRule ^newarticle/(.*[^/])/?$ /newarticle.php?blog=$1 [L]
RewriteRule ^comment/(.*[^/])/(.*[^/]) /?$ /comment.php?blog=$1&artic le=$2 [L]
RewriteRule ^article/(.*[^/])/(.*[^/]) /?$ /article.php?blog=$1&artic le=$2 [L]
RewriteRule ^archive/(.*[^/])/(.*[^/]) /?$ /archive.php?blog=$1&start =$2 [L]
RewriteRule ^archive/(.*[^/])/?$ /archive.php?blog=$1 [L]
RewriteRule ^stumble/(.*[^/])/(.*[^/]) /?$ /stumble.php?blog=$1&start =$2 [L]
RewriteRule ^stumble/(.*[^/])/?$ /stumble.php?blog=$1 [L]
RewriteRule ^games/game\.(.*)\.html$ /games/index.php?gameID=$1 [L]
RewriteRule ^games/game-(.*[^/])/?$ /games/index.php?gameID=$1 [L]
RewriteRule ^topic/(.*[^/])/(.*[^/])/? $ /topic.php?blog=$1&topic=$ 2 [L]
RewriteRule ^topic/(.*[^/])/?$ /topic.php?blog=$1 [L]
RewriteRule ^topic/?$ /topic.php [L]
RewriteRule ^blog/(.*[^/])/?$ /blog.php?blog=$1 [L]
RewriteRule ^404$ / [L,R]
(And yeah, all this stuff would line up in a monospace font.)
ErrorDocument 404 /404
RewriteEngine On
RewriteBase /
RewriteRule ^news/archive/(.*)\.(.*)\.
RewriteRule ^news/archive/(.*)\.html$ /news.php?do=archive&feedI
RewriteRule ^news/read/?$ /news.php?do=read [L]
RewriteRule ^news/?$ /news.php [L]
RewriteRule ^newarticle/(.*[^/])/?$ /newarticle.php?blog=$1 [L]
RewriteRule ^comment/(.*[^/])/(.*[^/])
RewriteRule ^article/(.*[^/])/(.*[^/])
RewriteRule ^archive/(.*[^/])/(.*[^/])
RewriteRule ^archive/(.*[^/])/?$ /archive.php?blog=$1 [L]
RewriteRule ^stumble/(.*[^/])/(.*[^/])
RewriteRule ^stumble/(.*[^/])/?$ /stumble.php?blog=$1 [L]
RewriteRule ^games/game\.(.*)\.html$ /games/index.php?gameID=$1
RewriteRule ^games/game-(.*[^/])/?$ /games/index.php?gameID=$1
RewriteRule ^topic/(.*[^/])/(.*[^/])/?
RewriteRule ^topic/(.*[^/])/?$ /topic.php?blog=$1 [L]
RewriteRule ^topic/?$ /topic.php [L]
RewriteRule ^blog/(.*[^/])/?$ /blog.php?blog=$1 [L]
RewriteRule ^404$ / [L,R]
(And yeah, all this stuff would line up in a monospace font.)
RewriteRule ^/topic/(.*)/(.*)/$ topic.php?blog=$1&topic=$2
david