Closed (fixed)
Project:
Subdomain
Version:
6.x-1.4
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
5 Feb 2009 at 18:26 UTC
Updated:
22 Jul 2009 at 22:25 UTC
It would be nice to have an option like "set www subdomain as default".
I needed to make www.example.com the default url, instead of example.com.
In order to do this, I've modified the subdomain module at the row 407:
else {
$options['base_url'] = 'http://www.'. subdomain_base_domain();
}
And I've modified the functions custom_url_rewrite_inbound and custom_url_rewrite_outbound in my settings.php in this way:
function custom_url_rewrite_outbound(&$path, &$options, $original_path) {
// Used by the Subdomain module to generate URLs with subdomains
if (module_exists('subdomain') and arg(0,$path)!='views') {
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') and arg(0,$path)!='views' and
substr($_SERVER['HTTP_HOST'],0,3)!='www') {
subdomain_url_rewrite_inbound($result, $path, $path_language);
}
}
The "views" part is a fix to an issue related to the views module ajax pager not working in subdomain pages.
Comments
Comment #1
jaxpax commentedI have had problems using www in my URL using the subdomain module but using your code snippets made it work like a charm, thank you so much sersim :-)
//Patrik
Comment #2
sersim commentedI'm happy too see that my code snippet is useful for other users.
Comment #3
jaxpax commentedI have seen that allot of others have had the same problem, by posting issues here. I'm not sure about how things work with patching, but wouldn't your snippets be suited as a patch?
Comment #4
setvik commentedFixed the www issue in CVS. It should be available in the next dev release.
The views patch i need to look at a little bit more to see how best to solve it (A similar issue affects the javascript in voting modules as well).
Renaming the issue to include views issue
Comment #5
setvik commentedwww issue is fixed for both 5.x and 6.x...
Comment #7
doublejosh commentedWhat about Ajax pagers on block views???This solution fixes block views within sub-domain pages. yay!
Comment #8
doublejosh commentedclosing