Download - Анатолій Поляков — Subdomains everywhere
![Page 1: Анатолій Поляков — Subdomains everywhere](https://reader034.vdocuments.us/reader034/viewer/2022051520/5883fe2f1a28ab884b8b530b/html5/thumbnails/1.jpg)
Subdomains everywhere Practices of using subdomains in Drupal websites.
Version 1.0Oct 18th, 2015
![Page 2: Анатолій Поляков — Subdomains everywhere](https://reader034.vdocuments.us/reader034/viewer/2022051520/5883fe2f1a28ab884b8b530b/html5/thumbnails/2.jpg)
What is the goal?
![Page 3: Анатолій Поляков — Subdomains everywhere](https://reader034.vdocuments.us/reader034/viewer/2022051520/5883fe2f1a28ab884b8b530b/html5/thumbnails/3.jpg)
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](https://reader034.vdocuments.us/reader034/viewer/2022051520/5883fe2f1a28ab884b8b530b/html5/thumbnails/4.jpg)
Subdomain processing diagram
![Page 5: Анатолій Поляков — Subdomains everywhere](https://reader034.vdocuments.us/reader034/viewer/2022051520/5883fe2f1a28ab884b8b530b/html5/thumbnails/5.jpg)
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](https://reader034.vdocuments.us/reader034/viewer/2022051520/5883fe2f1a28ab884b8b530b/html5/thumbnails/6.jpg)
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](https://reader034.vdocuments.us/reader034/viewer/2022051520/5883fe2f1a28ab884b8b530b/html5/thumbnails/7.jpg)
Subdomain module
![Page 8: Анатолій Поляков — Subdomains everywhere](https://reader034.vdocuments.us/reader034/viewer/2022051520/5883fe2f1a28ab884b8b530b/html5/thumbnails/8.jpg)
Custom code variants1. Model part: hook_outbound_alter().
2. Controller part - domain checking.
![Page 9: Анатолій Поляков — Subdomains everywhere](https://reader034.vdocuments.us/reader034/viewer/2022051520/5883fe2f1a28ab884b8b530b/html5/thumbnails/9.jpg)
hook_url_outbound_alter1. Altered domain parameter at L-function
2. Has entity object in arguments.
![Page 10: Анатолій Поляков — Subdomains everywhere](https://reader034.vdocuments.us/reader034/viewer/2022051520/5883fe2f1a28ab884b8b530b/html5/thumbnails/10.jpg)
Controller part.1. Create subdomain_get function.2. Use it across project.
![Page 11: Анатолій Поляков — Subdomains everywhere](https://reader034.vdocuments.us/reader034/viewer/2022051520/5883fe2f1a28ab884b8b530b/html5/thumbnails/11.jpg)
Example
![Page 12: Анатолій Поляков — Subdomains everywhere](https://reader034.vdocuments.us/reader034/viewer/2022051520/5883fe2f1a28ab884b8b530b/html5/thumbnails/12.jpg)
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](https://reader034.vdocuments.us/reader034/viewer/2022051520/5883fe2f1a28ab884b8b530b/html5/thumbnails/13.jpg)
Search engine double indexing problem.
![Page 14: Анатолій Поляков — Subdomains everywhere](https://reader034.vdocuments.us/reader034/viewer/2022051520/5883fe2f1a28ab884b8b530b/html5/thumbnails/14.jpg)
Q&A
![Page 15: Анатолій Поляков — Subdomains everywhere](https://reader034.vdocuments.us/reader034/viewer/2022051520/5883fe2f1a28ab884b8b530b/html5/thumbnails/15.jpg)
Thank you.
![Page 16: Анатолій Поляков — Subdomains everywhere](https://reader034.vdocuments.us/reader034/viewer/2022051520/5883fe2f1a28ab884b8b530b/html5/thumbnails/16.jpg)
Contacts
skype:anpolimus
site:techdirector.me
FB: https://www.facebook.com/anatoliy.polyakov