Fork me on GitHub
Current releases are 2.1.3 (9 Sept 2014) and 2.0.18.13 (5 Aug 2014)

Ready for 2.1? Find out if your favorite plugins are compatible. The 2.0 branch will no longer receive updates after Dec 2014.

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