I'd like to redirect
www.example.com/*
toexample.com/*
And at the same time redirect
example.com/*
toexample.com/forum/*
But I also have /wiki/
and /blog/
and /style/
, so I don't want to redirect
example.com/style/*
toexample.com/forum/style/*
This is what I have at the moment, which is not working quite correctly:
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^example\.com$ [NC]
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/forum/
RewriteRule ^(.*)$ forum/$1 [R=301,L]
Clarification: my question can be asked in a simpler way.
I'd like to redirect an *empty REQUEST_URI* or /, or a non-existent file only if it is in the root directory to /forum/.