2009-04-13 70 views
1

如何在Fusebox 5.1 noxml中创建搜索引擎安全URL?如何在Fusebox 5.1 noxml中创建搜索引擎安全URL?

举例来说,我想这一点: http://www.site.com/index.cfm/app.welcome/

取而代之的是: http://www.site.com/index.cfm?fuseaction=app.welcome

保险丝盒5.1假设是能够做到这一点。我读过这个article,但它只适用于xml版本。我知道这么少,我不知道从哪里开始。我如何用noxml版本的保险丝做到这一点?

更新: 它看起来像我需要将此添加到我的Application.cfc文件。仍然没有工作,但...

FUSEBOX_PARAMETERS.myself = "index.cfm/fuseaction/"; 
FUSEBOX_PARAMETERS.queryStringStart = "/"; 
FUSEBOX_PARAMETERS.queryStringSeparator = "/"; 
FUSEBOX_PARAMETERS.queryStringEqual = "/"; 

回答

1

保险丝盒5.1允许您通过允许您更改使用SES网址吗?到/的&。你仍然需要提供你自己的重写器。但是,如果你能够升级到5.5,它也可以处理重写。

例重写

http://www.fusebox.org/forums/messageview.cfm?catid=31&threadid=6117&STARTPAGE=2

<cfscript> 
// SES converter 
qrystring = ArrayNew(1); 
if (Find("/",cgi.path_info) eq 1 and Find("/#self#",cgi.path_info) eq 0) { 
qrystring = cgi.path_info; 
} else if (Len(Replace(cgi.path_info,"#self#/","")) gt 0) { 
qrystring = ListRest(Replace(cgi.path_info,"#self#/","#self#|"),"|"); 
} else if (FindNoCase("#self#/",cgi.script_name) gt 0) { 
qrystring = ListRest(Replace(cgi.script_name,"#self#/","#self#|"),"|"); 
} 
arQrystring = ListToArray(cgi.path_info,'/'); 
for (q = 1 ; q lte ArrayLen(arQrystring) ; q = q + 2) { 
if (q lte ArrayLen(arQrystring) - 1 and not (arQrystring[ Q ] is myFusebox.getApplication().fuseactionVariable and arQrystring[ q+1] is self)) { 
attributes['#arQrystring[ Q ]#'] = arQrystring[ q+1]; 
} 
} 
</cfscript> 

如果您选择使用Coldcourse ...

http://coldcourse.riaforge.com

下面将帮助您开始。如果您需要/index.cfm/circuit/action/格式化的网址,您可以忽略服务器端重写(适用于IIS的ISAPI)。但是如果你想要/电路/动作/或/等等/你需要使它成为服务器端。

的Application.cfc

上onApplicationStart(或onRequestStart用于测试)摆放在内存中。

<cfset application.coldcourse = createObject("component","components.util.coldcourse").init("/config/coldcourse.config.cfm")> 

index.cfm 将这个框架加载之前

<cfset application.coldcourse.dispatch(cgi.path_info, cgi.script_name) /> 

coldcourse.config.cfm(例如配置)

<cfset setEnabled(true)> 
<cfset setFrameworkEvent("action")> 
<cfset setFrameworkSeparator(".")> 
<cfset setFrameworkActionDefault("")> 
<cfset setUniqueURLs(true)> 
<cfset setBaseURL("http://www.mysite.com/index.cfm")> 

<!--- CUSTOM COURSES GO HERE (they will be checked in order) ---> 
<!--- for http://www.mysite.com/about/ pages ---> 
<cfset addCourse("components")> 
<cfset addCourse(pattern="about",controller="main",action="about")> 
<cfset addCourse(pattern="contact",controller="main",action="contact")> 
<cfset addCourse(pattern="help",controller="main",action="help")> 

<!--- If nothing else matches, fall back to the standard courses (you probably shouldn't edit these) ---> 
<cfset addCourse(":controller/:action/:id")> 
<cfset addCourse(":controller/:action")> 
<cfset addCourse(":controller")> 

安装ISAPI重写

请确保您使用的是正确的重写正则表达式,因为版本2.0与3.0不同。

2的示例。0脚本:如果你在你的网络日志得到一个404错误

# Coldcourse URL Rewrite for CF 
IterationLimit 0 
RewriteRule ^(/.+/.+/.*\?.+\..*)$ /index.cfm/$1 
RewriteRule ^(/[^.]*)$ /index.cfm/$1 

文件是否存在Web服务器

上禁用检查这样做对IIS。

  1. 打开IIS管理器
  2. 在网站上点击右键,选择属性
  3. 单击主目录选项卡
  4. 点击配置按钮 (对话框的右下角)
  5. 点击.CFM扩展名并选择 '编辑'
  6. 左下方复选框:“检查 文件是否存在”