如何在Fusebox5.1 noxml中创建搜索引擎安全URL?
例如,我想要这个:http://www.site.com/index.cfm/app.welcome/
而不是这个:http://www.site.com/index.cfm?fuseaction=app.welcome
Fusebox 5.1应该能够做到这一点。我读过这个文章,但它只适用于xml。我知道的太少了,我不知道从哪里开始。如何使用noxml版本的fusebox来实现呢?
更新:看起来我需要将它添加到我的Application.cfc文件中。但还是没工作..。
FUSEBOX_PARAMETERS.myself = "index.cfm/fuseaction/";
FUSEBOX_PARAMETERS.queryStringStart = "/";
FUSEBOX_PARAMETERS.queryStringSeparator = "/";
FUSEBOX_PARAMETERS.queryStringEqual = "/";发布于 2009-04-16 00:48:44
Fusebox5.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>如果你选择使用冷课程.
http://coldcourse.riaforge.com
以下将帮助您开始工作。如果您需要/index.cfm/路/action/格式化URL,可以忽略服务器端重写(针对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重写
确保您使用的是正确的重写regex,因为2.0版本与3.0不同。
2.0脚本示例:
# Coldcourse URL Rewrite for CF
IterationLimit 0
RewriteRule ^(/.+/.+/.*\?.+\..*)$ /index.cfm/$1
RewriteRule ^(/[^.]*)$ /index.cfm/$1禁用检查web服务器上是否存在文件
如果您的web日志中有404错误,请为IIS执行此操作。
发布于 2009-04-13 17:36:05
里亚福尔是你的朋友:
http://coldcourse.riaforge.org/
https://stackoverflow.com/questions/744181
复制相似问题