如果IIS默认文档设置为index.cfm
,你可以创建一个称为“thisPlace”的文件夹(目录),并放置一个index.cfm文件,该文件只包含一个<cflocation>
标记和随附的查询/逻辑来计算URL。
Website.com/thisPlace会按照您的描述运行。
编辑:
你可以添加自定义的404页...
使它成为一个.CFM文件,而不是HTML。扫描模板路径以查看用户正在查找的内容。如果您在数据库中找到它,请将它们重定向到那里,否则将它们重定向到一般的404页面。
<!---Up to a certain point (the directory in which you store your code) this will always be the same so you can hard-code your number --->
<cfset QueryConstant = #LEFT(CGI.CF_Template_Path, 22)#>
<!---Find the overall length of the template path. --->
<cfset QueryVariable = #Len(CGI.CF_Template_Path)#>
<!---Take whatever is past your QueryConstant (AKA the string that produces a 404 error.) --->
<cfset theRightNumber = QueryVariable - 22>
<cfset QuerySearchString = #RIGHT(CGI.CF_Template_Path, theRightNumber)#>
<cfquery name="ListOfLocations" datasource="CRM">
SELECT TOP 1 LocationID
FROM LocationTable
WHERE LocationName LIKE '%#QuerySearchString#%'
</cfquery>
<cfif ListOfLocations.recordcount>
<cflocation url="/SomePage.cfm?LocationID=#ListOfLocations.LocationID#">
<cfelse>
<cflocation url="/Regular404page.html">
</cfif>
为什么这个标签为'PHP'? – CD001
不知道,我提交时没有看到它。对不起,我删除了它。 –