Hello there,

I'm trying to create a rewrite condition for a set of rewrite rules. Currently this is what I have:

HTML and CSS Syntax (Toggle Plain Text)

RewriteCond %{HTTP_HOST} ^/?forum [NC]
RewriteRule ^([\w]+)/([\w]+)/?$ index.php?p=$1&s=$2 [NC,L,C]
RewriteRule ^([\w]+)/?$         index.php?p=$1 [NC,L]

What I want is to have the following uri, http://www.mywebsite.com/page1/page2, load a different page, http://www.mywebsite.com/index.php?p=page1&s=page2, by using mod rewrite.

Except when the query part starts with "forum" (for example: http://www.mywebsite.com/forum). When it does start with forum, I would like to really load the "forum" folder, instead of loading index.php?p=forum. However, my rewrite condition is not working right now. Can anyone please help me?

You should check %{REQUEST_URI} instead of %{HTTP_HOST}

I now have:

RewriteCond %{REQUEST_URI} forum
RewriteRule .* /forum [NC,R,L]

This works for the url http://mywebsite.com/forum, but when I try to load an image named "forum", it won't load. It does load, however, when I rename it to "forun", so it's definately a problem in my .htaccess. How can I fix this?

Check also this:

RewriteCond %{REQUEST_URI} !/forum