无标签可用.

应用教程

Typo3(模拟)静态网页生成的两种方法(英文)(转)

2006年07月16日 09:18 存在: 18 yrs
分类: 应用教程
作者: Typo3中国

补充说明: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_INFOconfig.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.
When it is done correctly the file is no longer visible in the folder

 

_.htaccess file in httpdocs folder - ftp view
 

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/


  打印版本  联系我们  到顶部   
最后更新日期 date