Jump to:
| Project: | Subdomain |
| Version: | 6.x-1.7 |
| Component: | Miscellaneous |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
Hi, I am attempting to use this module, with no success...
Things I've done:
0. Read the readme.txt
1. Added the code in step1 of the Readme.txt file
2. Added $cookie_domain
3. Configured wildcard (tested with test1.site.com and test2.site.com pointing to www.site.com w/out activating the module)
4. Enabled subdomains with node author
5. Set Tilde -> no action (and nothing else thus far, as I wanted to test what I did in step 3 AFTER activating the module).
After having activate the module, I get a "Page not Found" error on any subdomain I try (test1 and test2), AND www no longer works.
Things I've tried:
Renamed index.php to old.index.php and create a new index.php with:
TP_HOST:
<?php
print $_SERVER['HTTP_HOST']
?>QUERY_STRING:
<?php
print $_SERVER['QUERY_STRING']
?>REQUEST_URI:
<?php
print $_SERVER['REQUEST_URI']
?>When calling http://test1.site.com the output is :
TP_HOST: test1.site.com
QUERY_STRING: q=~test1/
REQUEST_URI: /
when calling http://test1.site.com/index.php the output becomes:
TP_HOST: test1.site.com
QUERY_STRING:
REQUEST_URI: /
(I've even tried to reset the .htaccess patch which is no longer needed...)
Any thoughts?
Tia,
S.
Comments
#1
I've also the same problem, and after 1 day of debug the solution is:
RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{HTTP_HOST} !^www\.([^.]+)\.([^.]+)$
RewriteCond %{HTTP_HOST} ^([^.]+)\.([^.]+)\.([^.]+)$
RewriteRule ^(.*)$ index.php?q=~%1/$1 [L,QSA]
(add second line to code aviable into README.txt)
#2
I had the same problem and your debug worked great. Thank you!!
#3
Same problem, followed the instructions in the README and the patch here and now I get "Page Not Found" with no theme information, it's text only.
#4
As soon as I copy/paste the functions to settings.php, any drupal page gives me a page not found error. Once I delete or comment out the functions, every page works.
Strange?!
#5
Yes I'm having the same problem too.
I enabled *.example.com first in cpanel and made public_html the base directory. That works great.
I then installed drupal (drupal-6.10.tar.gz) and then I downloaded and installed pathauto (pathauto-6.x-1.1.tar.gz) and then token (token-6.x-1.11.tar.gz) into sites/all/modules first. Then I installed subdomain (domain-6.x-2.0-rc6.tar.gz) into sites/all/modules also.
If I add:
function custom_url_rewrite_outbound(&$path, &$options, $original_path) {
// Used by the Subdomain module to generate URLs with subdomains
if (module_exists('subdomain')) {
subdomain_url_rewrite_outbound($path, $options);
}
}
function custom_url_rewrite_inbound(&$result, $path, $path_language) {
// Used by the Subdomain module to correctly interpret URLs with subdomains
if (module_exists('subdomain')) {
subdomain_url_rewrite_inbound($result, $path, $path_language);
}
}
to the end of settings.php I get:
Parse error: syntax error, unexpected $end in /home/....../public_html/sites/default/settings.php on line 230
If I put ?> at the end of the code I get page not found.
I've edited the cookie line too.
Without the settings.php being correctly edited I get:
----------------------------------------------
Drupal's inbound URL rewriting - show/hide details Not working yet
HTTP request to http://subdomain-test....../subdomain/test resulted in an internal Drupal path of subdomain/test. It should have been ~subdomain-test/subdomain/test
The custom_url_rewrite_inbound() function is missing from settings.php. It appears you haven't yet patched settings.php. See readme.txt for instructions.
Drupal's outbound URL rewriting - show/hide details Not working yet
Drupal API: url('~subdomain-test/subdomain/test') returned '/%7Esubdomain-test/subdomain/test' but should have returned 'http://subdomain-test./....../subdomain/test'
The custom_url_rewrite_outbound() function is missing from settings.php. It appears you haven't yet patched settings.php. See readme.txt for instructions.
----------------------------------------------
Apache version 2.0.63
PHP version 5.2.5
MySQL version 5.0.67-community
Drupal 6.10
Any help would be gratefully appreciated. :0)
#6
The D6 1.4 version of Subdomain does not require any changes to the .htaccess file.
but *does* require a patch to settings.php. The following code should be placed at the bottom of your settings.php as per the README.TXT file:
function custom_url_rewrite_outbound(&$path, &$options, $original_path) {
// Used by the Subdomain module to generate URLs with subdomains
if (module_exists('subdomain')) {
subdomain_url_rewrite_outbound($path, $options);
}
}
function custom_url_rewrite_inbound(&$result, $path, $path_language) {
// Used by the Subdomain module to correctly interpret URLs with subdomains
if (module_exists('subdomain')) {
subdomain_url_rewrite_inbound($result, $path, $path_language);
}
}
The php "unexpected $end" error you're getting usually happens if you've forgotten a closing "}" or ")" somewhere and can possibly happen if you end the file with "?>". If you have a closing "?>" at the end of the file, be sure and remove it.
#7
Thanks for that, sorry it took a while to get back to you. I was getting confused between domain access and subdomain. All sorted now, thank you for your time!
#8
#9
Automatically closed -- issue fixed for 2 weeks with no activity.
#10
I'm re-opening this issue because the exact same error (page not found) is happening when upgrading the Drupal core to v. 6.17. Upgrade the codebase... subdomains dispappear. Revert to 6.16, and they're back.
Has anyone found a solution to this?
#11
I put the rewrite rules from comment #1 into the Apache virtual host file and the same error occurs ('Page not found.')
This issue may be related to another thread:
http://drupal.org/node/423102
Also, contrary to the README.txt, the Subdomain Prerequisites page states:
Drupal's inbound URL rewriting - show/hide details Not working yet
HTTP request to http://subdomain-test.domain/subdomain/test resulted in an internal Drupal path of . It should have been ~subdomain-test/subdomain/test
The custom_url_rewrite_inbound() function in settings.php is rewriting the internal path incorrectly. Did you patch settings.php? See readme.txt for instructions.
For good measure, I applied the patch (which is supposed to be removed) to settings.php and got the following error:
Fatal error: Call to undefined function subdomain_url_rewrite_inbound()
#12
I had an aweful experience installing this module and my issue related to Drupal v6.17 and the settings.php file - in particular the cookie setting.
After a lot of head scratching, I stumbled upon a line in the readme of 6.17 which made it all work.
=============================
Incompatible changes
Drupal 6.17 introduces the following incompatible changes.
Session handling
Drupal 6.17 changes the way session cookies are handled. Most people don't need to have this setting set, but if you have an explicit $cookie_domain set in settings.php, verify that it is set to a sensible value:
'example.com' if you want sessions to apply to the example.com domain, and none of its sub-domains (especially not www.example.com),
'www.example.com' if you want sessions to apply to the www.example.com domain, and none of its sub-domains nor parent domains (especially not example.com),
'.example.com' if you want sessions to apply to the example.com domain and all its subdomains (www.example.com, mydomain.example.com, etc.).
=============================
Once I changed my settings.php cookie line to the following, it all worked:
$cookie_domain = '.geekandjock.com';
Note the preceding '.' to the domain name
#13
Thanks for tracking down the solution to this perplexing problem. I've now got 6.17 successfully upgraded... a dot in front of the cookie domain, who knew?
#14
Fantastic - great module too. Best of luck with your site too.
#15
Automatically closed -- issue fixed for 2 weeks with no activity.