Page not Found with subdomains.
| Project: | Subdomain |
| Version: | 6.x-1.4 |
| Component: | Miscellaneous |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
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.

#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.