如何设置 Typo3 v10 站点配置等同于通配符但有一个例外?
How to set Typo3 v10 site config for the equivalent of wildcards but with one exception?
如何设置 Typo3 V10 站点配置来执行此操作:
- 所有传入的内容都转到一个站点根页面:
- 除了这个子域,它转到一个单独的根页面:
我有一个基于 Typo3 8.7 的网络应用程序,我正在尝试将其升级到 v10。在 8.7 应用程序中,每个客户组织都有一个唯一的子域 - school1.webapp.com、anotherschool.webapp.com 等,都指向同一个 typo3 站点根页面。每次我需要创建一个新客户时,我所要做的就是添加一个新的 sys_domain 记录,然后自定义插件会选择当前的 sys_domain 记录作为分离客户数据的方法。 *.webapp.com 的通配符 sys_domain 记录会拾取任何拼写错误并重定向到单独的页面。
唯一的例外是 auth。webapp.com 它处理所有客户的 oauth 身份验证并转到不同的站点根页面。
这让我可以通过一个简单的表单添加新客户,添加新的 sys_domain 记录并完成工作。
我现在需要升级到 Typo3 v10。我可以很容易地检测到传入的子域以在客户数据之间进行拆分,但是我在使用新的站点配置工具时遇到了问题。我所需要的只是将 auth.webapp.com 路由到一个站点的根页面,并将其他所有内容路由到另一个站点。
我当前的设置似乎可以让所有内容路由到站点根目录
- Entry point /
- Variant Base: https://%env(HTTP_HOST)%/
Condition: getenv("HTTP_HOST") == "*"
但是如果我为 auth.webapp.com 域创建第二个站点条目,我只会收到 FE 错误
“找不到页面 - 页面不存在或无法访问。原因:请求的页面不存在”
Entry point https://auth.webapp.com
/auth.webapp.com/ 的入口点导致此子域转到主要客户入口点,即使 yaml 条目说它指向正确的起点。
MAIN SITE - All incoming subdomains except auth.webapp.com
base: /
baseVariants:
-
base: 'https://%env(HTTP_HOST)%/'
condition: 'getenv("HTTP_HOST") == "*"'
errorHandling:
-
errorCode: 404
errorHandler: Page
errorContentSource: 't3://page?uid=13'
-
errorCode: 403
errorHandler: Page
errorContentSource: 't3://page?uid=1'
-
errorCode: 500
errorHandler: Page
errorContentSource: 't3://page?uid=14'
flux_content_types: ''
flux_page_templates: ''
languages:
-
title: English
enabled: true
base: /
typo3Language: default
locale: en_GB.UTF-8
iso-639-1: en
websiteTitle: 'Website Title Name'
navigationTitle: ''
hreflang: en-GB
direction: ''
flag: gb
languageId: 0
rootPageId: 1
websiteTitle: 'Website Title Name'
AUTHENTICATION SITE - just auth.webapp.com
base: 'https://auth.webapp.com/'
flux_content_types: ''
flux_page_templates: ''
languages:
-
title: English
enabled: true
base: /
typo3Language: default
locale: en_GB.UTF-8
iso-639-1: en
websiteTitle: ''
navigationTitle: ''
hreflang: ''
direction: ''
flag: gb-eng
languageId: 0
rootPageId: 11
websiteTitle: 'Website Title'
在这种情况下,您应该使用网络服务器提供的环境变量。
设置即 AUTHENTICATED 作为除 auth.webapp.com 之外的任何其他指标将有助于过滤常见配置条件的基本变体,并确保 auth.webapp.com 将被跳过。
乔的回答成功了。我在这里发布更多内容以帮助其他人。
==============
.htaccess file
==============
<If "%{HTTP_HOST} != 'unique\.domain\.com'">
SetEnv SPECIALNAME_ALLOW allow
</If>
<If "%{HTTP_HOST} == 'unique\.domain\.com'">
SetEnv SPECIALNAME_ALLOW skip
</If>
==============
Typo3 SITE entry for the unique domain
==============
Entry Point - https://unique.domain.com/
Variant Base - https://unique.domain.com/
Variant Condition - getenv("SPECIALNAME_ALLOW ") == "skip"
==============
Typo3 SITE entry for everything else
==============
Entry Point - /
Variant Base - /
Variant Condition - getenv("SPECIALNAME_ALLOW ") == "allow"
如何设置 Typo3 V10 站点配置来执行此操作:
- 所有传入的内容都转到一个站点根页面:
- 除了这个子域,它转到一个单独的根页面:
我有一个基于 Typo3 8.7 的网络应用程序,我正在尝试将其升级到 v10。在 8.7 应用程序中,每个客户组织都有一个唯一的子域 - school1.webapp.com、anotherschool.webapp.com 等,都指向同一个 typo3 站点根页面。每次我需要创建一个新客户时,我所要做的就是添加一个新的 sys_domain 记录,然后自定义插件会选择当前的 sys_domain 记录作为分离客户数据的方法。 *.webapp.com 的通配符 sys_domain 记录会拾取任何拼写错误并重定向到单独的页面。
唯一的例外是 auth。webapp.com 它处理所有客户的 oauth 身份验证并转到不同的站点根页面。
这让我可以通过一个简单的表单添加新客户,添加新的 sys_domain 记录并完成工作。
我现在需要升级到 Typo3 v10。我可以很容易地检测到传入的子域以在客户数据之间进行拆分,但是我在使用新的站点配置工具时遇到了问题。我所需要的只是将 auth.webapp.com 路由到一个站点的根页面,并将其他所有内容路由到另一个站点。
我当前的设置似乎可以让所有内容路由到站点根目录
- Entry point /
- Variant Base: https://%env(HTTP_HOST)%/
Condition: getenv("HTTP_HOST") == "*"
但是如果我为 auth.webapp.com 域创建第二个站点条目,我只会收到 FE 错误 “找不到页面 - 页面不存在或无法访问。原因:请求的页面不存在”
Entry point https://auth.webapp.com
/auth.webapp.com/ 的入口点导致此子域转到主要客户入口点,即使 yaml 条目说它指向正确的起点。
MAIN SITE - All incoming subdomains except auth.webapp.com
base: /
baseVariants:
-
base: 'https://%env(HTTP_HOST)%/'
condition: 'getenv("HTTP_HOST") == "*"'
errorHandling:
-
errorCode: 404
errorHandler: Page
errorContentSource: 't3://page?uid=13'
-
errorCode: 403
errorHandler: Page
errorContentSource: 't3://page?uid=1'
-
errorCode: 500
errorHandler: Page
errorContentSource: 't3://page?uid=14'
flux_content_types: ''
flux_page_templates: ''
languages:
-
title: English
enabled: true
base: /
typo3Language: default
locale: en_GB.UTF-8
iso-639-1: en
websiteTitle: 'Website Title Name'
navigationTitle: ''
hreflang: en-GB
direction: ''
flag: gb
languageId: 0
rootPageId: 1
websiteTitle: 'Website Title Name'
AUTHENTICATION SITE - just auth.webapp.com
base: 'https://auth.webapp.com/'
flux_content_types: ''
flux_page_templates: ''
languages:
-
title: English
enabled: true
base: /
typo3Language: default
locale: en_GB.UTF-8
iso-639-1: en
websiteTitle: ''
navigationTitle: ''
hreflang: ''
direction: ''
flag: gb-eng
languageId: 0
rootPageId: 11
websiteTitle: 'Website Title'
在这种情况下,您应该使用网络服务器提供的环境变量。
设置即 AUTHENTICATED 作为除 auth.webapp.com 之外的任何其他指标将有助于过滤常见配置条件的基本变体,并确保 auth.webapp.com 将被跳过。
乔的回答成功了。我在这里发布更多内容以帮助其他人。
==============
.htaccess file
==============
<If "%{HTTP_HOST} != 'unique\.domain\.com'">
SetEnv SPECIALNAME_ALLOW allow
</If>
<If "%{HTTP_HOST} == 'unique\.domain\.com'">
SetEnv SPECIALNAME_ALLOW skip
</If>
==============
Typo3 SITE entry for the unique domain
==============
Entry Point - https://unique.domain.com/
Variant Base - https://unique.domain.com/
Variant Condition - getenv("SPECIALNAME_ALLOW ") == "skip"
==============
Typo3 SITE entry for everything else
==============
Entry Point - /
Variant Base - /
Variant Condition - getenv("SPECIALNAME_ALLOW ") == "allow"