Forum Moderators: phranque
RewriteCond %{ENV:REDIRECT_SUBDOMAIN} =""
RewriteCond %{HTTP_HOST} ([a-z0-9][-a-z0-9]+)\.example\.com\.?(:80)?$ [NC]
RewriteCond %{DOCUMENT_ROOT}/%1 -d
RewriteRule ^(.*) %1/$1 [E=SUBDOMAIN:%1,L]
RewriteRule ^ - [E=SUBDOMAIN:%{ENV:REDIRECT_SUBDOMAIN},L]
This script works beautifully. However, I am using a content management system that has a feature where it will build a sitemap (virtually) from all pages. But it fails when this redirect method is employed.
Does anyone know why that might be?
[edited by: jdMorgan at 4:01 pm (utc) on Jan. 25, 2010]
[edit reason] example.com [/edit]
I had to make my CMS' subdomain sites refer to its config file in the ROOT directory instead of a copy that lives in the subdirectory.
Back to working perfectly again. Thanks, @jdMorgan for all the amazing work you've posted here.