PDA

View Full Version : RewriteRule adds document root to path


MrZippy
01-20-2010, 01:18 PM
Scenario

1. Shared hosting
2. Multiple domains hosted on one account
3. Each domain is a subfolder off the primary domain
4. Multiple domains (spelling variants) point to same folder
5. Rewrite in domain folder to rewrite to main domain variant

RewriteCond %{HTTP_HOST} !^domain\.com$ [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]

This points all domains (for it's folder) to domain.com but there is a problem.

http://primary_domain.com/domain
This rewrites to:
http://domain.com//var/chroot/home/content/x/x/x/xxxxxx/html/domain

http://primary_domain.com/domain/ rewrites to http://domain.com as it should

If I remove $1 off the rewriterule it works, but of course looses any file names.

Am I missing something silly here?