16
Subdomains everywhere Practices of using subdomains in Drupal websites. Version 1.0 Oct 18th, 2015

Анатолій Поляков — Subdomains everywhere

Embed Size (px)

Citation preview

Page 1: Анатолій Поляков — Subdomains everywhere

Subdomains everywhere Practices of using subdomains in Drupal websites.

Version 1.0Oct 18th, 2015

Page 2: Анатолій Поляков — Subdomains everywhere

What is the goal?

Page 3: Анатолій Поляков — Subdomains everywhere

Our goal is to move some parts of the website powered by Drupal to the subdomain

1. Nodes on subdomain;2. Parts of the content at subdomain;3. Terms on the subdomain;4. Custom pages at the subdomain.

Page 4: Анатолій Поляков — Subdomains everywhere

Subdomain processing diagram

Page 5: Анатолій Поляков — Subdomains everywhere

Existed contrib modules1. Domain Access (https://www.drupal.org/project/domain).

Stable module for configuring subdomains as part of multisite project.

2. Subdomain (https://www.drupal.org/project/subdomain).

Stable basic module for subdomain processing at one Drupal installation.

Main features:

- user, taxonomy, content type, OG => subdomain.

3. Subdomain field (https://www.drupal.org/project/subdomain_field).

Alpha module for managing subdomain as field item.

Coverage of contrib for this feature is very weak.

Page 6: Анатолій Поляков — Subdomains everywhere

Existed issues problems1. There are no views integration.

2. There are no context plugin.

3. Contrib modules have many issues and bugs.

4. There is no complete solution for homepage.

Page 7: Анатолій Поляков — Subdomains everywhere

Subdomain module

Page 8: Анатолій Поляков — Subdomains everywhere

Custom code variants1. Model part: hook_outbound_alter().

2. Controller part - domain checking.

Page 9: Анатолій Поляков — Subdomains everywhere

hook_url_outbound_alter1. Altered domain parameter at L-function

2. Has entity object in arguments.

Page 10: Анатолій Поляков — Subdomains everywhere

Controller part.1. Create subdomain_get function.2. Use it across project.

Page 11: Анатолій Поляков — Subdomains everywhere

Example

Page 12: Анатолій Поляков — Subdomains everywhere

Configuration steps1. Domain needs wildcard record;

2. Webserver should route all domains and subdomains to one drupal

folder.

3. For session saving along all subdomains, we have to add record at

settings.php file.

Page 13: Анатолій Поляков — Subdomains everywhere

Search engine double indexing problem.

Page 14: Анатолій Поляков — Subdomains everywhere

Q&A

Page 15: Анатолій Поляков — Subdomains everywhere

Thank you.

Page 16: Анатолій Поляков — Subdomains everywhere

Contacts

skype:anpolimus

site:techdirector.me

FB: https://www.facebook.com/anatoliy.polyakov