Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

.htaccess rules not working for forum

edited July 2011 in Vanilla 2.0 - 2.8
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.