繁体   English   中英

将TYPO3多层树中的页面树转换为SSL

[英]Conversion of a pagetree within a TYPO3 multitree to SSL

在多树TYPO3项目中,仅一棵树应迁移到SSL。 为此,我必须在该树中将所有页面的url_scheme设置为“ https”。 但是,由于存在很多方面,因此手动解决它不是很有效。

示例页面树

+-- TYPO3 6.2 LTS
+--+-- Pagetree A (DE)               // need only this pagetree converted to SSL
+--+--+-- Pagetree A Subpage 1 (DE)
+--+--+-- Pagetree A Subpage 2 (DE)
+--+--+-- Pagetree A Subpage 3 (DE)
+--+-- Pagetree B (EN)
+--+--+-- Pagetree B Subpage 1 (EN)
+--+--+-- Pagetree B Subpage 2 (EN)
+--+--+-- Pagetree B Subpage 3 (EN)
+--+-- Pagetree C (FR)
+--+--+-- Pagetree C Subpage 1 (FR)
+--+--+-- Pagetree C Subpage 2 (FR)
+--+--+-- Pagetree C Subpage 3 (FR)
+--+-- Pagetree D (COM)
+--+--+-- Pagetree D Subpage 1 (COM)
+--+--+-- Pagetree D Subpage 2 (COM)
+--+--+-- Pagetree D Subpage 3 (COM)

以下SQL命令可用于将所有页面设置为所需值:

UPDATE pages SET url_scheme = 2

但是我只需要一个SQL更新命令用于我的单个页面树(A)。 有谁知道SQL命令的查找方式?

灵感来自这里: https : //www.wacon.de/typo3-know-how/umstellung-von-http-auf-https-mit-typo3.html

如果每个PageTree的URI不同,则可以尝试使用.htaccess RewriteCond直接重定向到您的SSL版本:

RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.tld$
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

否则,您必须确定哪些子页面属于“ Pagetree A”。 一个简单的SQL查询可能是:

UPDATE pages SET url_scheme = 2 WHERE pid = UID_OF_PAGETREE_A OR uid = UID_OF_PAGETREE_A

如果您有多个树级,那将会很复杂。 然后,您必须找到页面树的uid,然后还要更新这些页面,像这样的人可以更新您的第二个页面树:

UPDATE pages SET url_scheme = 2 WHERE pid IN (SELECT uid FROM pages WHERE pid = UID_OF_PAGETREE_A)

您可以使用cf_cache_rootline表来检索递归子页面的列表。 在SQL中这样做很丑陋,因为您需要手动解析序列化的数组,但是它可以工作:

使用以下查询检查您是否获得了一些有意义的数据:

set @pid = 40; select REPLACE(identifier, '__0_0_0', '') as ids from cf_cache_rootline where content like CONCAT('%"pid";s:', LENGTH(@pid), ':"', @pid, '"%' ) and identifier like '%\_\_0\_0\_0';

然后更新将是(给定PageTree A的uid = 40):

SET @pid = 40;
UPDATE pages SET url_scheme = 2 WHERE uid = @pid OR uid IN (select REPLACE(identifier, '__0_0_0', '') FROM cf_cache_rootline WHERE content LIKE CONCAT('%"pid";s:', LENGTH(@pid), ':"', @pid, '"%' ) AND identifier LIKE '%\_\_0\_0\_0');

还有一个站点说明,要为该子树永久启用url_scheme=2 ,您可以添加一个页面TSConfig,以便为新页面设置此设置:

[PIDinRootline = 40]
TCAdefaults.pages.url_scheme = 2
[global]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM