I'm hosting multiple domains on a shared account under one root.
My primary domain is obviously hosted in root, and other subsequent domains have their roots based in subdirectories 'therein'.
I installed wordpress in root for the primary domain (domain1.com/.htaccess) and the htaccess looks like so:
- Code: Select all
#trying to force 'WWW' Prefix.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain1\.com
RewriteRule ^(.*)$ http://www.domain1.com/$1 [R=301,L]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
I have domain2 in '/domain2.com/' where it's files are, and a copy of Wordpress installed at '/domain2.com/blog/'.
To attempt to force the 'WWW' prefix for domain2.com, here's domain2.com/.htaccess :
- Code: Select all
RewriteBase /
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain2\.com
RewriteRule ^(.*)$ http://www.domain2.com/$1 [R=301,L]
ErrorDocument 404 /404.html
Which seems to work fine, even the custom error doc (that gets over-ridden once in the /blog/ dir anyway)... but any URL to "domain2.com/blog/..." doesn't get the WWW prefix added to it.
I *thought* that htaccess worked on all subdirectories, so I left the 'domain2.com/blog/.htaccess' as follows:
- Code: Select all
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
When I tried to correct it to force the WWW I somehow ended up at 'domain2.com/domain2'. Several other configurations that normally work give a 500 error.
How can I force the WWW on 'domain2.com/blog/whatever' and maintain the query string? The only way I've gotten it to work sent me back to "www.domain2.com" without the rest of the URL.
[there were other larger problems and lots of 500 errors, but I think they've smoothed out, so hopefully this will be my only question.]
Thanks so much!