I have a SS site set up on a server with hostgator no problems at all, however this site will also contain another SS "Add on Domain" which is installed into the public_html folder as addondomain.com, the problem i am having is with the url rewrites from non www to www. this is what i have:
Main domain:
### SILVERSTRIPE START ###
<Files *.ss>
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Files>
<Files web.config>
Order deny,allow
Deny from all
</Files>
ErrorDocument 404 /assets/error-404.html
ErrorDocument 500 /assets/error-500.html
<IfModule mod_alias.c>
RedirectMatch 403 /silverstripe-cache(/|$)
</IfModule>
<IfModule mod_rewrite.c>
DirectoryIndex index.php
SetEnv HTTP_MOD_REWRITE On
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.maindomain\.com$
RewriteRule (.*) http://www.maindomain.com/$1 [R=301,L]
RewriteCond %{REQUEST_URI} ^(.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L]
### SILVERSTRIPE END ###
in the add on domain htaccess:
### SILVERSTRIPE START ###
<IfModule mod_dir.c>
DirectorySlash Off
</IfModule>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^addondomain.com [NC]
RewriteRule ^(.*)$ http://www.addondomain.com/$1 [R=301,NC,L]
RewriteCond %{REQUEST_URI} !(\.gif)|(\.jpg)|(\.png)|(\.css)|(\.js)|(\.php)$
RewriteCond %{REQUEST_URI} ^(.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L]
### SILVERSTRIPE END ###
as advised the rewrite conditions for non www to www are running below RewriteBase, but what is happening is for both domains the urls from non www do get rewritten but at the end of the url they are suffixed with .com/sapphire/main.php?url=/ this is for both domains, i also tried to force non www through via mysite _config.php but this has the same result.. any ideas? thanks