Typo3:使用typoscript 修改base-url [英] Typo3 : using typoscript to modify the base-url

查看:29
本文介绍了Typo3:使用typoscript 修改base-url的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在试用TYPO3的介绍包.为此,我在计算机上使用 Xampp.

I am trying out TYPO3's introduction package. For that I am using Xampp on my computer.

我已经将它安装在一个子目录中,但由于它使用了real-url",我需要修改生成的链接,而不是 http://localhost/about-typo3/我得到 http://localhost/subfolder/about-typo3/

I have installed it in a subdirectory, but since it uses "real-url", I need to modify the generated links, so that instead of http://localhost/about-typo3/ I get http://localhost/subfolder/about-typo3/

我相信它必须通过typo-script"完成,从我在互联网上阅读的内容来看,这条线应该可以完成这项工作:

I believe it must be done via "typo-script", and from what I have read on the Internet, this line should do the job :

config.baseURL = http://localhost/subfolder/

但是我不知道我应该把它放在哪里.我尝试了不同的位置,但没有明显的效果.

But I don't know where I should put it. I have tried different locations, but with no apparent effect.

所以我想知道的是:我是否处于我需要做的事情的良好道路上,如果是,我现在应该尝试什么?

So what I would like to know is : am I on the good path for what I need to do, and if yes, what should I try now ?

推荐答案

这是 4.6 简介包中的一个错误.4.7 将附带正确的版本,因此您可能只想继续尝试 4.7RC2 中的介绍包(Preview发布).

This is a bug in the 4.6 Introduction Package. 4.7 will ship with a correct version, so you might just want to go ahead and try the Introduction Package from 4.7RC2 (Preview Releases).

现在,只需在左侧的模块菜单中选择Template.然后使用下拉菜单选择Constant Editor.现在在中间的页面树中选择页面 HOME.现在使用第二个下拉菜单选择 CONFIG.修改最上面的设置Absolute URI prefix.输入不带最后一个斜杠 (/) 的完整域.这意味着从浏览器复制您当前的 URL 并删除 /typo3/backend.php.现在使用顶部工具栏中的小保存图标进行保存.这也将使您的所有缓存无效(因为您更改了最顶层的模板).无需安装额外的扩展程序或手动执行此操作.

For now, just choose Template in the module menu on the left. Then use the dropdown to select Constant Editor. Now choose the page HOME in the pagetree on the middle. Now use the second dropdown to select CONFIG. There modify the topmost setting Absolute URI prefix. Input your full domain without the last slash (/). That means copy your current URL from the browser and strip /typo3/backend.php. Now save with the little save icon in the top toolbar. This will also invalidate all caches for you (because you changed the topmost template). No need to install extra extensions or to do this manually.

或者,您可以修复实际的错误.转到模板模块并选择文件夹 TypoScript Templates/page_configuration.现在选择 Info/Modify 而不是 Constant Editor 并直接位于表 page.config 上方.单击 Setup 左侧的铅笔.找到行 absRefPrefix = {$config.absRefPrefix}/.这应该在 62 (4.7RC2) 行附近.删除该行的最后一个斜杠 (/) 并保存.因为您不在最顶层的模板上,所以需要清除缓存.在屏幕的右上角,您可以找到黄色的闪光灯图标.单击它并选择Clear all caches(红色闪烁).现在再次访问您的网站.

Alternative you can fix the actual bug. Go to template module and select the folder TypoScript Templates / page_configuration. Now select Info/Modify instead of Constant Editor and directly above the table page.config. The click the pencil left of Setup. Find the line absRefPrefix = {$config.absRefPrefix}/. This should be around line 62 (4.7RC2). Remove the last slash (/) from that line and save. Because you are not on the topmost template, you need to clear the cache. On the topright of your screen, you can find the yellow flash icon. Click it and select Clear all caches (red flash). Now go to you website again.

关于(config.)baseURL 的一般说明.这更像是一种黑客行为,因为它只是告诉浏览器表现得好像网站在另一个地方一样.正确的方法是首先创建正确的链接.您应该使用 (config.)absRefPrefix 代替.要使其在自动模式下工作,它必须完全为空(config.absRefPrefix =).不要再使用 baseURL.下一个介绍包不会有这个设置.

A general note about (config.)baseURL. This is more a hack, because it just tells the browser to behave as if the website would be at another place. The correct way is to create correct links in first place. You should use (config.)absRefPrefix instead. To make this work in auto mode, it must be completely empty (config.absRefPrefix =). Do not use baseURL any more. The next Introduction Package will not have this setting.

还有一点要注意:如果您使用 config.absRefPrefix,则必须包括最后一个斜杠 (/).您不必在上面(在常量中)这样做的唯一原因是因为它在模板中进行了硬编码,因此也会阻止自动检测工作.

Yet another note: If you use the config.absRefPrefix, you have to include the last slash (/). The only reason why you do not have to do so above (in the constants), is because it is hardcoded in the template and thus also preventing the automatic detection to work.

这篇关于Typo3:使用typoscript 修改base-url的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆