LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 09-30-2010, 08:57 AM   #1
bgdomainer
LQ Newbie
 
Registered: Sep 2010
Posts: 1

Rep: Reputation: 0
Sub domain configuration in apache (on debian)


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?
 
Old 10-01-2010, 04:58 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi,

I suggest you to enable rewrite logging and watch how the URI is being rewritten
Also error_log could tell you what was the faulty request.

Regards
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
domain configuration mehnaz Linux - Newbie 2 08-16-2009 07:54 PM
Workgroup vs Domain configuration santhosh.bachu Linux - Networking 1 07-27-2006 07:19 AM
Sendmail domain configuration don_wombat Linux - Software 5 02-25-2005 11:09 AM
debian sarge apache-ssl configuration notolerance Debian 0 01-10-2005 10:44 AM
Apache 2 configuration problems - Cannot resolve domain notmatt Linux - Networking 4 06-09-2004 02:02 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 03:45 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration