Fork me on GitHub
Current release is 2.1.6 (21 Nov 2014).

Users who have not yet upgraded to 2.1 should get security release 2.0.18.14 (1 Nov 2014). We will stop providing these security releases to 2.0 at the end of this year.

.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.