silverstripe/multi-domain
Composer 安装命令:
composer require silverstripe/multi-domain
包简介
Allows multiple domains to access one CMS instance, mapping them to different sections of the hierarchy
关键字:
README 文档
README
Allows multiple domains to access one CMS instance, mapping them to different sections of the hierarchy, which allows for vanity URLs. Examples:
example.com-> resolves to home pageexample.com/shop/store-> Resolves to a Store pageexample-store.com-> Shows content forexample.com/shop/store.example-store.com/checkout-> Shows content forexample.com/shop/store/checkout
Requirements
- silverstripe/framework ^4.0
Configuration
Each domain is identified by a key. You must define one domain using the primary key to mark it as the primary domain.
--- Name: mymultidomain After: '#multidomain' --- SilverStripe\MultiDomain\MultiDomain: domains: primary: hostname: 'example.com' store: hostname: 'example-store.com' resolves_to: 'shop/store'
Options
allow_subdomains: If true, domain matching is subdomain agnostic, so that anything.example.com still maps to example.com, the primary domain in the above configuration.
Whitelisting
Sometimes you may have routes that should resolve normally, and bypass the multidomain filter. In this case, for any given domain, you can specify an allow list.
--- Name: mymultidomain After: '#multidomain' --- SilverStripe\MultiDomain\MultiDomain: domains: primary: hostname: 'example.com' store: hostname: 'example-store.com' resolves_to: 'shop/store' allow: - 'admin/*' - 'Security/*' - 'my-custom-webhook/'
In the above example, any URL beginning with admin/, Security/ or matching my-custom-webhook/ will resolve on any domain.
Global whitelists
You can put your allow node directly under MultiDomain to have a global whitelist.
--- Name: mymultidomain After: '#multidomain' --- SilverStripe\MultiDomain\MultiDomain: allow: - 'admin/*' - 'Security/*' - 'my-custom-webhook/'
Forcing URLs to specific domains
Sometimes, you may have a page that sits outside the node representing a domain, but you still want it to be considered part of that domain. For this, you can use the force option.
--- Name: mymultidomain After: '#multidomain' --- SilverStripe\MultiDomain\MultiDomain: domains: primary: hostname: 'example.com' store: hostname: 'example-store.com' resolves_to: 'shop/store' force: - 'buy-now/*'
In the above configuration, the page buy-now can live in the site root, but the URL example-store.com/buy-now
will nonetheless resolve the page, even though the page isn't under shop/store.
Using environment variables
If you have multiple test environments, it may not make sense for you to hard code the host name in the config. Alternatively, you can define an environment variable, i.e. a constant, and refer to it as a string in the config.
--- Name: mymultidomain After: '#multidomain' Only: environment: 'test' --- SilverStripe\MultiDomain\MultiDomain: domains: primary: hostname: STAGING_PRIMARY_HOSTNAME store: hostname: STAGING_STORE_HOSTNAME resolves_to: 'shop/store' force: - 'buy-now/*'
This way, every environment can declare its hostname independently.
Why not subsites?
Subsites creates a parallel CMS instance for a given domain name. This module allows you to map domains to a specific section of the hierarchy, in the context of all your other pages.
Why not "homepage for domain"?
That works to create a vanity URL for one page, but as soon as you go deeper into the hierarchy, you return to the native URL. A more robust solution is required for persisting the vanity URLs.
Further, this module is more extensible, allowing for collaboration with other URL-hungry modules, such as Translatable or Fluent.
silverstripe/multi-domain 适用场景与选型建议
silverstripe/multi-domain 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.57k 次下载、GitHub Stars 达 14, 最近一次更新时间为 2015 年 07 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「silverstripe」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 silverstripe/multi-domain 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 silverstripe/multi-domain 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 silverstripe/multi-domain 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Analytics chooser extensions for site settings.
CitaNZ's SilverStripe picture object and field for SilverStripe 4
bootstrap select field module implementing http://silviomoreto.github.io/bootstrap-select/
Allows you to defined CMS form structure via config.yml
A module for adding a podcast or multiple podcasts to your SilverStripe site. With support for audio, video or other files.
统计信息
- 总下载量: 1.57k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 14
- 点击次数: 23
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2015-07-09