如何在Fusebox 5.1 noxml中创建搜索引擎安全网址? [英] How do I create Search Engine Safe URLs in Fusebox 5.1 noxml?

查看:205
本文介绍了如何在Fusebox 5.1 noxml中创建搜索引擎安全网址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



例如,我想要:
http://www.site.com/index.cfm/app.welcome/



而不是这样:
http://www.site.com/index.cfm?fuseaction=app.welcome



假设保险箱5.1能够执行此操作。我已阅读此文章,但它仅适用于xml版本。我知道这么少,我不知道从哪里开始。如何使用noxml版本的fusebox?



更新
看起来我需要将其添加到我的Application.cfc文件。仍然无法正常工作...

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


解决方案

Fusebox 5.1允许您使用SES URL改变 ? &至 /。你还需要提供自己的重写器。



重写器示例

b $ b

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

 < cfscript> 
// SES转换器
qrystring = ArrayNew(1);
if(Find(/,cgi.path_info)eq 1和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#|),|);
} 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和arQrystring [q + 1]是self)){
attributes ['#arQrystring [Q]#'] = arQrystring [q + 1];
}
}
< / cfscript>

如果您选择使用Coldcourse ... b
$ b

http://coldcourse.riaforge.com



以下将帮助您开始。如果您想要/index.cfm/circuit/action/格式化的URL,您可以忽略服务器端重写(IIS的ISAPI)。



application.cfc p>

放在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 (示例config)

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

<!--- CUSTOM课程在这里(他们将按顺序检查)--->
<!--- 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)>

<!---如果没有什么匹配,回到标准课程(你可能不应该编辑这些)--->
< cfset addCourse(:controller /:action /:id)>
< cfset addCourse(:controller /:action)>
< cfset addCourse(:controller)>

安装ISAPI重写



请确保您使用的是正确的rewrite regex,因为版本2.0与3.0不同。



2.0脚本示例:

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

禁用检查Web服务器上是否存在文件



您的网络日志中出现404错误。


  1. 打开IIS管理器

  2. 并选择属性

  3. 点击主目录标签

  4. 点击配置按钮
    (对话框右下角)

  5. 点击.cfm扩展名并选择
    '编辑'

  6. 左下角的复选框:检查
    文件是否存在


How do I create Search Engine Safe URLs in Fusebox 5.1 noxml?

For instance, I want this: http://www.site.com/index.cfm/app.welcome/

Instead of this: http://www.site.com/index.cfm?fuseaction=app.welcome

Fusebox 5.1 is suppose to be able to do this. I've read this article, but it only applies to the xml version. I know so little, I am not sure where to start. How do I do it with the noxml version of fusebox?

Update: It looks like I need to add this to my Application.cfc file. Still not working though...

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

解决方案

Fusebox 5.1 allows you to use SES URLs by allowing you to change ? & to /. You still need to provide your own rewriter. However, if you are able to upgrade to 5.5 it supposedly handles rewriting, too.

Example Rewriter

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>

If you choose to use Coldcourse...

http://coldcourse.riaforge.com

Below will help you get started. You can ignore server-side rewriting (ISAPI for IIS) if you want /index.cfm/circuit/action/ formatted URLs. But if you want /circuit/action/ or /blah/ you'll need to make it server side.

application.cfc

Put on onApplicationStart (or onRequestStart for testing) to put in memory.

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

index.cfm Place this before the framework loads

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

coldcourse.config.cfm (example config)

<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")>

Install ISAPI Rewrite

Make sure you are using the correct rewrite regex because version 2.0 is different from 3.0.

Example for 2.0 script:

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

Disable Check if File Exists on web server

Do this for IIS if you're getting a 404 error in your web logs.

  1. Open the IIS manager
  2. Right click on a site and choose Properties
  3. Click the Home Directory tab
  4. Click the Configuration button (lower right of dialog)
  5. Click the .cfm extension and choose 'Edit'
  6. The lower left checkbox: "Check that File Exists"

这篇关于如何在Fusebox 5.1 noxml中创建搜索引擎安全网址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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