Htaccess for vbulletin forum installed in subdirectory?

I have a vbulletin site installed and setup on my server in a subdirectory. I am having issues with having the correct htaccess to route the domain to that subdirectory. I have it working right now and was told this way isnt the best way (but its working). I have several vbulletin sites setup and for some reason this one is giving me problems.

<Files .htaccess>
order allow,deny
deny from all
</Files>

RedirectMatch permanent ^/$ http://motonews.com/forum

The sites settings on the admin have the site URL and homepage URL both set to http://www.example.com/forum. I was told to try this htaccess that it would be better but it wouldnt let people login to the site, or reset passwords or anything for that matter other than view the site.

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www.motonews.com [NC]
RewriteRule ^(.*)$ http://motonews.com/$1 [L,R=301]
RewriteRule ^/?$ "http\\:\\/\\/motonews\\.com\\/forum" [R=301,L]

What is the cleanest way to direct www.example.com to the subdirectory? If no htaccess was provided it was just showing a list of directories on my server (which isnt what I want).

Thanks, Clayton

Clayton,

The simplest way would be to move all your files into the DocumentRoot. Anything else just makes no sense.

Okay, other options:

  1. Use an index.php file in the DocumentRoot with a link to the forum.

  2. If you’re indeed, refusing to use files in the DocumentRoot (except .htaccess), use something like:

RewriteEngine on
RewriteBase /forum

RewriteCond %{REQUEST_URI} !^/forum
RewriteRule .? /forum%{REQUEST_URI} [L]

As for your code:

RedirectMatch permanent ^/$ http://motonews.com/forum

Then

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www.motonews.com [NC]
RewriteRule ^(.*)$ http://motonews.com/$1 [L,R=301]
RewriteRule ^/?$ "http\\:\\/\\/motonews\\.com\\/forum" [R=301,L]

[LIST][] I dislike using the RewriteBase directory because it can adversely affect redirections.
[
] You failed to escape the dot characters in your regex (:tup: though for the No Case flag)
[] Capturing the {REQUEST_URI} with the :kaioken: EVERYTHING :kaioken: atom is a waste of server resources
[
] Your regex states that you do not know whether you’re using an Apache 1.x or Apache 2.x server but you want only the domain to have been requested. Clearly, that’s NOT what you want. Then you’ve quoted and escaped EVERYTHING in the redirection (when quotes and escapes are never used); how silly is that?[/LIST]

You might benefit from reading the mod_rewrite tutorial linked in my signature as it contains explanations and sample code. It’s helped may members and should help you, too.

Regards,

DK

Thanks, I will put the files in root. I just wish i really knew all this wizardry when it comes to apache and htaccess.

Thanks for the help, and suggestions!