Forum Moderators: phranque
RewriteEngine on
RewriteRule ^/forum/(foo|bar)(?:/(.+))? /forum/$2?topic=$1 [NC,QSA]
# I also have these rules...
#
# to change example.com/forum/this-is-a-subject/12345 to example.com/forum/view.php?id=12345
RewriteRule ^/forum/[a-z-]+/(\d+)/?$ /forum/view/index.php?id=$1 [NC,QSA,L]
# to change example.com/forum/favorites to example.com/forum/index.php?favorites=1 or
# example.com/forum/foo/favorites to example.com/forum/index.php?topic=foo&favorites=1
RewriteRule ^/forum/(favorites|post)(?:\.php|/)?$ /forum/index.php?$1=1 [NC,QSA,L]
# if there's no ID# then search by the this-is-a-subject part of the URL
RewriteRule ^/forum/([a-z-]+)/?$ /forum/index.php?p=$1 [NC,QSA,L]
# safety net
RewriteCond %{QUERY_STRING} (?:^|&)topic=[a-z-]+ [NC]
RewriteRule ^/forum(?:/(.+))? - [NC,L] what happens when you manually request manually request this?
example.com/forum/?topic=foo
also, did you check the web server error log file?
I really don't understand the logic behind [PT]It's one of those flags that you never have to think about until you move from htaccess to your own server, because it’s implied in directory contexts. It mainly comes into play when the result of a RewriteRule has to interact with a later mod_alias rule.