-
☆ A M B ☆
- 24,524 Posts
Is anyone else using Hostmonster and their add-on domains to host multiple domains? I can’t seem to get friendly URLs to work for the add-on domains.
They work fine for the main domain in the root, and the domain.com -> www.domain.com rewrite rules work fine for the add-on domains.
But trying to use friendly URLs for the add-on domain generates 500 server errors.
-
☆ A M B ☆
- 2,213 Posts
Did you set the base path in the htaccess? Also if you check your server logs it will give you more information regarding the 500 error.
-
☆ A M B ☆
- 24,524 Posts
Yes (of course), and no. Just the 500 error return in the raw access logs. Nothing relevant in the error logs either.
-
☆ A M B ☆
- 2,213 Posts
Remove the rewrite on line and try it again. If I recall right any subfolders should in theory pick up the parent folders htaccess. If that dosn’t work I can take a look for you.
-
☆ A M B ☆
- 24,524 Posts
Well, I sort of accidentally found the solution. I was implementing a mod_rewrite solution to preventing the subdomain.maindomain.com access, and suddenly the friendly URL rewrite began to work as well. I had immediately suspected the RewriteEngine On line myself; on most hosts having those redundant lines will cause 500 errors. But in this case, they are necessary.
So here’s the .htaccess file I ended up with for add-on domains on Hostmonster:
# For full documentation and other suggested options, please see
# http://svn.modxcms.com/docs/display/MODx096/Friendly+URL+Solutions
# including for unexpected logouts in multi-server/cloud environments
# and especially for the first three commented out rules
#php_flag register_globals Off
#AddDefaultCharset utf-8
#php_value date.timezone Europe/Moscow
# For security reasons, Option followsymlinks cannot be overridden.
#Options +FollowSymlinks
Options +SymLinksIfOwnerMatch
RewriteEngine On
#RewriteBase /subdirectory
# Fix Apache internal dummy connections from breaking [(site_url)] cache
RewriteCond %{HTTP_USER_AGENT} ^.*internal\ dummy\ connection.*$ [NC]
RewriteRule .* - [F,L]
# Rewrite domain.com -> www.domain.com -- used with SEO Strict URLs plugin
#RewriteCond %{HTTP_HOST} .
#RewriteCond %{HTTP_HOST} !^www\.example\.com [NC]
#RewriteRule (.*) http://www.example.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^subdomain.maindomain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.subdomain.maindomain.com$ [OR]
RewriteCond %{HTTP_HOST} ^add-ondomain.com$
RewriteCond %{REQUEST_URI} ^/$
RewriteRule ^(.*)$ http://www.add-ondomain.com/ [R=301,L]
# Exclude /assets and /manager directories from rewrite rules
RewriteRule ^(manager|assets) - [L]
# For Friendly URLs
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
# Reduce server overhead by enabling output compression if supported.
#php_flag zlib.output_compression On
#php_value zlib.output_compression_level 5
AddType text/x-component htc
-
☆ A M B ☆
- 2,213 Posts
Glad to hear you got it working! Thanks for sharing the solution.
-
☆ A M B ☆
- 24,524 Posts
I suspect that this came up because the main domain’s installation is in the root, and the three add-on domains are in subdirectories. I’ve always had all installation in subdirectories with the root empty when I’ve had more than one domain being handled from one web root. It may have been a conflict in the rewrite rules for the root-level installation and the subdirectories. The extra lines redirecting more specifically maybe what resolved the conflict (if there was one).
In any case, problem solved, and I move on to the next issue...