<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /forum/

DirectoryIndex index.php

RewriteRule ^index\.php$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
</IfModule>