Fork me on GitHub
Please upgrade to 2.1.x here. The 2.0 branch is no longer being updated.
Important security fix: 2.1.10, released 4 May.

.htaccess rules not working for forum

edited July 2011 in Vanilla 2.0 Help
Hi,

I have my forum in the directory forum but have an .htaccess file in the root with the following rules.
[code]
RewriteCond %{HTTP_HOST} ^www.domain1\.com$ [OR]
RewriteCond %{HTTP_HOST} ^domain1\.co\.uk$ [OR]
RewriteCond %{HTTP_HOST} ^www\.domain2\.co\.uk$ [OR]
RewriteCond %{HTTP_HOST} ^www\.domain2\.co\.uk$ [OR]
RewriteCond %{HTTP_HOST} ^www\.maindomain\.co\.uk$
RewriteRule (.*) http://maindomain.co.uk/$1 [R=301,L]
[/code]

This works perfectly fine for the site apart from when viewing the /forum directory, the domain doesn't redirect. So for example

domain1.co.uk/forum
should redirect to
maindomain.co.uk/forum
But it doesn't

The below works fine
domain1.co.uk/anotherdirectory

I tried adding the same rules to the vanilla forum .htaccess file but still no joy. This is what i added there.

[code]

RewriteEngine On

RewriteBase /forum
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php\?p=$1 [QSA,L]

RewriteCond %{HTTP_HOST} ^www.domain1\.com$ [OR]
RewriteCond %{HTTP_HOST} ^domain1\.co\.uk$ [OR]
RewriteCond %{HTTP_HOST} ^www\.domain2\.co\.uk$ [OR]
RewriteCond %{HTTP_HOST} ^www\.domain2\.co\.uk$ [OR]
RewriteCond %{HTTP_HOST} ^www\.maindomain\.co\.uk$
RewriteRule (.*) http://maindomain.co.uk/$1 [R=301,L]

[/code]

I've tried using different base, just "/" and also "/forum/". But nothing. Any suggestions.

Thanks in advance.

Ben
Sign In or Register to comment.