www restriction ignored

sersim - February 5, 2009 - 18:26
Project:Subdomain
Version:6.x-1.4
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed
Description

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.

#1

jaxpax - February 18, 2009 - 19:53

I 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

#2

sersim - February 19, 2009 - 09:53

I'm happy too see that my code snippet is useful for other users.

#3

jaxpax - February 19, 2009 - 13:49

I 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?

#4

setvik - March 18, 2009 - 12:55
Title:www subdomain as default» www restriction ignored & views ajax issue
Status:active» postponed (maintainer needs more info)

Fixed 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

#5

setvik - April 3, 2009 - 13:08
Title:www restriction ignored & views ajax issue» www restriction ignored
Status:postponed (maintainer needs more info)» fixed

www issue is fixed for both 5.x and 6.x...

#6

System Message - April 17, 2009 - 13:10
Status:fixed» closed

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

#7

doublejosh - July 22, 2009 - 22:25
Status:closed» active

What about Ajax pagers on block views???

This solution fixes block views within sub-domain pages. yay!

#8

doublejosh - July 22, 2009 - 22:25
Status:active» closed

closing

 
 

Drupal is a registered trademark of Dries Buytaert.