Hello guys,
i have several sites hosted on one machine (Apache 2.2 on Debian). They are configured at /etc/apache2/sites-available/ with this configuration (part of it):
======================
...
RewriteMap lowercase int:tolower
RewriteRule ^(.+) ${lowercase:%{SERVER_NAME}}$1 [C]
RewriteRule ^(([^\.\/]+\.)?site1\.com)/(.*) /www/site1.com/www/root/$3 [L]
RewriteRule ^(([^\.\/]+\.)?site2\.com)/(.*) /www/site2.com/www/root/$3 [L]
RewriteRule ^(([^\.\/]+\.)?site3.com)/(.*) /www/site3.com/www/root/$3 [L]
RewriteRule ^(([^\.\/]+\.)?site4\.com)/(.*) /www/site4.com/www/root/$3 [L]
RewriteRule ^(([^\.\/]+\.)?site5\.com)/(.*) /www/site5.com/www/root/$3 [L]
RewriteRule ^(([^\.\/]+\.)?[^\.\/]+\.[^\.\/]+)/(.*) /www/site2.com/www/root/$3 [L]
...
=====================
my the problem is with site2.com(only it has sub-subdomains, other has only subdomains), so based on this config every (sub)subdomain(for site2) will be redirected to a particular directory which is /www/site2.com/www/root
there is a .htaccess file with the following content:
--------------------------------------
php_value upload_max_filesize 11M
php_flag magic_quotes_gpc Off
php_flag register_globals Off
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$
RewriteRule ^(.*)$
http://%1 [NE,L]
RewriteCond %{HTTP_HOST} ^somemobi.mobi$
RewriteRule ^(.*)$ http://m.site2.com%{REQUEST_URI}?%{QUERY_STRING} [NE,L]
RewriteCond %{HTTP_HOST} ^(.+).somemobi.mobi$
RewriteRule ^(.*)$ http://m.%1.site2.com%{REQUEST_URI}?%{QUERY_STRING} [NE,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?%{QUERY_STRING} [NE,L]
--------------------------------
everithing is working perfect and when you write in you browser
www.site2.com it redirects you to
http://site2.com, subdomains are working too, like subdomain.site2.com, but the problem comes when i try to visit the mobile version of a particular subdomain - m.subdomain.site2.com and this generates the 400 Bad request Error, there is a problem even with
www.subdomain.site2.com, it also generates 400 error.
Can someone gives me some hint where the problem is?