# === www.test.example.com ===
# First be sure to rewrite the request to a unique domain
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^test\.example\.com [NC]
RewriteCond %{HTTP_HOST} ^www\.test\.example\.com [NC]
RewriteRule (.*) http://test.example.com/$1 [R=301,L]
# Rewrite the homepage of each domain to index.html
RewriteRule ^$ /index.html
# Do the other magic: Rewrite the the requests to for MODx readable folders
RewriteCond %{HTTP_HOST} test\.example\.com [NC]
RewriteCond %{REQUEST_URI} !^/manager
RewriteCond %{REQUEST_FILENAME} index\.php [OR]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(index\.(html?|php)|test/)?(.*)$ index.php?q=/test/$3 [L,QSA]
@worchyld: I have a couple subdomains configured this way and I haven’t encountered the problem you described. Maybe you can learn something useful from this that may help with your problem:
# === www.test.example.com === # First be sure to rewrite the request to a unique domain RewriteCond %{HTTP_HOST} . RewriteCond %{HTTP_HOST} !^test\.example\.com [NC] RewriteCond %{HTTP_HOST} ^www\.test\.example\.com [NC] RewriteRule (.*) http://test.example.com/$1 [R=301,L] # Rewrite the homepage of each domain to index.html RewriteRule ^$ /index.html # Do the other magic: Rewrite the the requests to for MODx readable folders RewriteCond %{HTTP_HOST} test\.example\.com [NC] RewriteCond %{REQUEST_URI} !^/manager RewriteCond %{REQUEST_comLENAME} index\.php [OR] RewriteCond %{REQUEST_comLENAME} !-f RewriteCond %{REQUEST_comLENAME} !-d RewriteRule ^(index\.(html?|php)|test/)?(.*)$ index.php?q=/test/$3 [L,QSA]
Lammikko, may I ask you to provide me with the complete .htaccess file you’re using? I just can’t get around the problem I have described a few posts earlier: when I’m using QuickManager in conjunction with the multidomain feature (using the button "Edit Resource"), the system jumps (after saving of the edited page in QM) to the homepage instead of the page I’m editing. It makes multidomain unusable for me :-( It must have something to do with mod_rewrite, because it seems to work for everyone else.
+ [folder] www.example2spain.co.uk
- somethinginhere.html
+ [folder] www.anothernichedomain.co.uk
- somethinginhere.html
All other stuff relating to example2travel goes here.
www.topleveldomain.co.uk/somenichedomain-co-uk/
www.topleveldomain.co.uk/somenichedomain-co-uk/somechild/
# Actual domain name altered for security
# === START: domain stuff ===
# First be sure to rewrite the request to a unique domain
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} ^travel2spain\.co.uk [NC]
RewriteCond %{HTTP_HOST} !^www\.travel2spain\.co.uk [NC]
RewriteRule (.*) http://www.travel2spain.co.uk/$1 [R=301,L]
# rewrite the homepage of each domain to index.html
RewriteRule ^travel2spain-co-uk$ /index.html
# do the other magic: Rewrite the the requests to for MODx readable folders
RewriteCond %{HTTP_HOST} travel2spain\.co.uk [NC]
RewriteCond %{REQUEST_URI} !^/manager
RewriteCond %{REQUEST_FILENAME} index\.php [OR]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(index\.(html?|php)|travel2spain-co-uk)?(.*)$ index.php?q=/travel2spain-co-uk/$3 [L,QSA]
# === END: domain stuff ===
// This is from the tutorial
RewriteEngine On
RewriteBase /
# First be sure to rewrite the request to a unique domain
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} ^domain1\.com [NC]
RewriteCond %{HTTP_HOST} !^www\.domain1\.com [NC]
RewriteRule (.*) http://www.domain1.com/$1 [R=301,L]
# rewrite the homepage of each domain to index.html
RewriteRule ^domain1-com\.html$ /index.html
# do the other magic: Rewrite the the requests to for MODx readable folders
RewriteCond %{HTTP_HOST} domain1\.com [NC]
RewriteCond %{REQUEST_URI} !^/manager
RewriteCond %{REQUEST_FILENAME} index\.php [OR]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(index\.(html?|php)|domain1-com)?(.*)$ index.php?q=/domain1/$3 [L,QSA]