应用教程
TYPO3 模拟静态(simulate Static Documents)功能设置方法两种(转)
简介:simulate Static Documents功能是typo3自身具备的功能,不依赖于其它外部扩展插件实现.只需要服务器安装相关模块,主要是mod_rewrite模块,服务器支持及可.
一般在项目过程中,使用typo3这个功能的时候不多,而是主要使用RealUrl扩展(插件).在此收集在这里,只是做为知识,让您了解有这个东西和它的使用方法而已.
此文章以前曾命名标题为"Typo3(模拟)静态网页生成的两种方法(英文)(转)",并不准确.当时出于误解和知识不足造成.在此改为更准确的标题
方法1:Simulate Static Documents Path
Typo3 creates this path in the address bar of the browser for this page:
www.xxx.com/index.php
but you want it to appear like this:
www.xxx.com/index.php/Static_Doc_Path/969/0/
The solution is quite simple. Place this code in the Setup of your Typo3 Template
# Set up PATH_INFO:
config.simulateStaticDocuments = PATH_INFO
config.simulateStaticDocuments_addTitle = 30
#This line defines length of the title with number of characters.
config.simulateStaticDocuments_addTitle = 30
The search engine spiders this every time it visits your site. If you want to improve your standing in the search engine periodically vary the number you place here. The spider will notice the change and index your page again because it thinks it is a different page.
It's even possible to prevent the default page-type (0) to be appended
config.simulateStaticDocuments_noTypeIfNoTitle = 1
so you can have URLs like
http://www.server.domain/alias.html
方法2:Simulate Static Document Path - Version 2
This version will show a document path ending with html like this: http://www.XXXX.com/Simulate_Static_Document_Path_V_2.1042.0.html which is search engine friendly.
Rename _.htaccess file
Important to prevent future headaches with no access to _.htaccess configure the Apache Server to always show the file regardless if it has an underscore in front of it or not.
First the _.htaccess file in the root directory has to be renamed. In my install it was in the httpdocs folder. It is done through ftp. It has to be renamed to .htaccess, the underscore has to be removed.
Activate Static Documents
The Static Documents Option is activated through the Install Tool.
Screenshot from the Install Tool
Log into the Install Tool
Select #4: All Configuration
Scroll down to [FE] section
Scroll down to 'SimulateStaticDocuments' and place a checkmark in the box
Scroll to the bottom of the page and click on 'Write to localconf.php'
TS Setup Code
Place this code into the Setup Section of the Typo3 Template:
#Simulate Static Document
config.simulateStaticDocuments = 1
config.simulateStaticDocuments_addTitle = 30
#The first line actives the Simulate Static Documents Option
#The second line shows the number of digits the title can have
Tip from Jochen Weiland's Tutorial for Simulating Static Documents:
In case the Rewrite module is not available in your Apache configuration you can also use the following syntax in your template setup:
config.simulateStaticDocuments = PATH_INFO
This will change the links to the form www.mydomain.com/123/0. If you are using the PATH_INFO method, it could be that some graphics do not show correctly or some links are broken. In this case you also need to set the variable absRefPrefix to the path (with trailing slash!) to your index.php file, for example:
config.absRefPrefix = http:// www.mydomain.com/