System: Drupal 5.10 - Apache/2.2.3 - PHP 5.2.0 - MySQL 5.0.26 - DNS: djbdns 1.05

I made all the installation steps correctly in Readme.txt (I think).

Symptom:

HTTP request to http://subdomain-test.portal.mydomain.hu/subdomain/test returned the following result:

HTTP_HOST:	subdomain-test.portal.mydomain.hu
QUERY_STRING:	subdomain/test
REQUEST_URI:	subdomain/test
SCRIPT_FILENAME:	/srv/www/htdocs/hosted/siteb/index.php
The REQUEST_URI should have been rewritten as '~subdomain-test/subdomain/test'.

Your web server is not rewriting your URLs correctly.

Apache config:

NameVirtualHost *:80
<VirtualHost *:80>
    ServerAdmin webmaster@mydomain.hu
    DocumentRoot /srv/www/htdocs/hosted/siteb/
    ServerName portal.mydomain.hu
    ServerAlias *.portal.mydomain.hu

    <Directory "/srv/www/htdocs/hosted/siteb/">
      AllowOverride All
    </Directory>
</VirtualHost>

I confirmed that I correctly patched .htaccess file.

I modified settings.php:
$cookie_domain = "example.com";

I installed my drupal under "portal.mydomain.hu" domain name with pathauto 5.x-2.3 and og 5.x-7.3 modules.
I created og content type and two organic group ("a" and "b").
When I enabled the subdomain module and enter under "portal.mydomain.hu" domain, i get "page not found".
Only under "www.portal.mydomain.hu" domain can I enter into my site.

Where may I have ruined it?

Comments

nagygdev’s picture

Corretly:

I modified settings.php:
$cookie_domain = "portal.mydomain.hu";

So, where may I have ruined it?

setvik’s picture

Subdomain currently just supports 2-level domains out of the box (e.g. example.com).

To support base domains with 3 levels like yours, open your .htaccess file and scroll down to the following section added by the htaccess patch:

  # REQUIRED BY SUBDOMAIN.MODULE
  # Moves subdomain to URI path
  # e.g: mysubdomain.example.com 
  # becomes example.com/index.php?_mysubdomain/
  # NOTE: does not rewrite subdomain if it is "www". 
  # If you want it to rewrite www, disable the 2nd line
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{HTTP_HOST} !^www\.([^.]+)\.([^.]+)$
  RewriteCond %{HTTP_HOST} ^([^.]+)\.([^.]+)\.([^.]+)$
  RewriteRule ^(.*)$ index.php?q=~%1/$1 [L,QSA]

Change the 2nd and 3rd RewriteCond statements to the following:

  RewriteCond %{HTTP_HOST} !^www\.([^.]+)\.([^.]+)\.([^.]+)$
  RewriteCond %{HTTP_HOST} ^([^.]+)\.([^.]+)\.([^.]+)\.([^.]+)$

Give that a try and let me know how it goes.

setvik’s picture

Status: Active » Postponed (maintainer needs more info)
nagygdev’s picture

Status: Postponed (maintainer needs more info) » Fixed

It works!

Perfect. This is a solution.

Thank you setvik!

setvik’s picture

No problem :-).

Glad you were able to get it working

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

Dimm’s picture

Version: 6.x-1.2-rc1 » 6.x-1.0
Status: Closed (fixed) » Active

$cookie_domain in settings.php - Not yet set

Drupal	6.4
PHP	5.2.6
PHP register globals	Off. 
MySQL	4.1.22
Apache/1.3.37 (Unix) mod_gzip/1.3.26.1a PHP/5.2.6
DNS server - show/hide details	Working
test-1.subdomain.domain.com successfully resolved to 
test-2.subdomain.domain.com successfully resolved to 
test-3.subdomain.domain.com successfully resolved to 

Web server - show/hide details	Working
HTTP request to http://subdomain-test.subdomain.domain.com/subdomain/test returned the following result:
HTTP_HOST:	subdomain-test.subdomain.domain.com
QUERY_STRING:	subdomain/test
REQUEST_URI:	subdomain/test
SCRIPT_FILENAME:	/home/krasmebel/subdomain.domain.com/docs/index.php
drupal_get_normal_path:	~subdomain-test/subdomain/test

Drupal's inbound URL rewriting - show/hide details	Working
HTTP request to http://subdomain-test.subdomain.domain.com/subdomain/test resulted in an internal Drupal path of ~subdomain-test/subdomain/test

Drupal's outbound URL rewriting - show/hide details	Working
Drupal API: url('~subdomain-test/subdomain/test') returned 'http://subdomain-test.subdomain.domain.com/subdomain/test'

$cookie_domain in settings.php - show/hide details	Not yet set
The $cookie_domain variable in settings.php is not set. Uncomment and set the $cookie_domain variable to your base domain (e.g. "example.com")

I set $cookie_domain="subdomain.domain.com" in settings.php, but it not work.

I add to htaccess (as #2 )

  RewriteCond %{HTTP_HOST} !^www\.([^.]+)\.([^.]+)\.([^.]+)$
  RewriteCond %{HTTP_HOST} ^([^.]+)\.([^.]+)\.([^.]+)\.([^.]+)$

, but it not work.
Can you help me?

setvik’s picture

Did you uncomment the $cookie_domain line? i.e. did you remove the "#" from in front of "$cookie_domain"?

setvik’s picture

Status: Active » Postponed (maintainer needs more info)
Dimm’s picture

Did you uncomment the $cookie_domain line? i.e. did you remove the "#" from in front of "$cookie_domain"?
Yes :)

setvik’s picture

Dimm,

whoops, I should have noticed this before, but if you are using the latest version of 6.x, you don't need to change your .htaccess file in any way.

i.e. If you put the following section in your .htaccess file

 # REQUIRED BY SUBDOMAIN.MODULE
  # Moves subdomain to URI path
  # e.g: mysubdomain.example.com
  # becomes example.com/index.php?_mysubdomain/
  # NOTE: does not rewrite subdomain if it is "www".
  # If you want it to rewrite www, disable the 2nd line
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{HTTP_HOST} !^www\.([^.]+)\.([^.]+)$
  RewriteCond %{HTTP_HOST} ^([^.]+)\.([^.]+)\.([^.]+)$
  RewriteRule ^(.*)$ index.php?q=~%1/$1 [L,QSA]

go ahead and remove it

Dimm’s picture

I found error!
First I comment string
# $cookie_domain = 'example.com';
And write my string
$cookie_domain = 'mydomain.com';
It give error.
$cookie_domain in settings.php - show/hide details Not yet set

Now I delete string
# $cookie_domain = 'example.com';
Work Ok:
$cookie_domain in settings.php - show/hide details Set

Problem in function subdomain_check_cookie_domain()
It found comment line # $cookie_domain = 'example.com'; and give error.

setvik’s picture

Status: Postponed (maintainer needs more info) » Fixed

glad you were able to fix it :-).

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.