Gossamer Forum
Home : General : Internet Technologies :

mod_rewrite rules help

Quote Reply
mod_rewrite rules help
I've got a folder under the root dir of the web site that is specified as a vhost for a subdomain. So this subdir can be accessed at http://subdir.maindir.com but also at http://www.maindir.com/subdir
Now If I access via http://www.maindir.com/subdir Apache gives a forbidden error and I accept that because the right way is to access via http://subdir.maindir.com
How can I setup apache so that if someone access via http://www.maindir.com/subdir gets automatically to http://subdir.maindir.com ?
I want a clean and powerful setup so probably I should use mod_rewrite but I have no idea on how to do this...
Please help
Thanks
Max
The one with Mac OS X Server 10.4 :)
Quote Reply
Re: [maxpico] mod_rewrite rules help In reply to
Hi,

Well, the rewrite rule would look like:

RewriteRule /subdir/?(.*) http://subdir.domain.com/$1 [R,L]

to redirect a user to the subdir.domain.com directory.

Not sure if that's the best solution as you really didn't give enough info. =)

Cheers,

Alex
--
Gossamer Threads Inc.