Staging, Live, SSURL and 404
I had a client who had a set up like this: 2 web servers 1
database/file server They wanted to have one of the web servers as
the "live" server so users would do most, if not all, browsing on
that server, and the second "staging" server to do all the updating
of content etc. The 2 servers share the site database, and FMS file
stores. One of the considerations of this is SSURLs (Search Safe
URL). When a section/page is created in ShadoMX, the folder/file
structure is created on the server. This means people can have a
"friendly" url. EG: rather than
"index.cfm?D101A4EB-F9A1-E879-4682-4D806C7C7F96" you can access the
page with "section/subsection/thispage.cfm" In the clients example
above, if a page is created on the staging server, the SSURL file
is NOT created automatically on the live server. The way we handled
this was by making use of the servers "404" template. The client
was using IIS, to we set up the 404 error to point to our
"/[sitename]/app_templates/bin/404.cfm" template and in ColdFusion
Administrator, undersettings, put the same information in the
"Missing Template Handler" In the System Pages in the Shado site
tree, we made a page called "404 - File not found" The 404.cfm
checks to see if the page exists in the site tree, and if it does,
it writes the SSURL file, and then forwards the user on to that
file. If it does not exist, it will forward the user on to the "404
- File not found" page we set up The contents of the 404.cfm:
<cfparam name="sRelocate" default="[URL to
default 404
message]">
<cfset request.shado.siteName = "[sitename]">
<cfinvoke component="shadomx.core.loader" method="init">
<cfscript>
//do we have a page to look
for?
if(len(cgi.script_Name)){
//set up
the vars we need
qThisPage =
false;
sThisPage =
cgi.script_Name;
oPages =
application.shado_obj_factory.get("shadomx.core.pages.shado_obj_pages");
oTree =
application.shado_obj_factory.get("shadomx.core.sections.buildtree");
//is the
site name at the beginning of the script?
if(listFirst(sThisPage,"/") eq request.sitecontext.dsn){
//if it is, take it
off...
sThisPage =
replaceNoCase(sThisPage,"/#request.sitecontext.dsn#","");
}
//Find if
there is a page in the DB
qThisPage =
oPages.get(page_ssurl = sThisPage);
if(qThisPage.recordCount){
//if we find the page, write the
SSURL file
oTree.CreateSSURLPage(
parent_circuit_uuid=qThisPage.circuit_uuid,
page_uuid=qThisPage.uuid,
sitename=request.siteContext.dsn,
updateDB=true
);
sRelocate =
"/#request.sitecontext.dsn#/#sThisPage#";
}
}
</cfscript>
<cflocation url="#sRelocate#" addtoken="false">
NB: This has not been testing on a multi-language site
<cfset request.shado.siteName = "[sitename]">
<cfinvoke component="shadomx.core.loader" method="init">
<cfscript>
//do we have a page to look for?
if(len(cgi.script_Name)){
//set up the vars we need
qThisPage = false;
sThisPage = cgi.script_Name;
oPages = application.shado_obj_factory.get("shadomx.core.pages.shado_obj_pages");
oTree = application.shado_obj_factory.get("shadomx.core.sections.buildtree");
//is the site name at the beginning of the script?
if(listFirst(sThisPage,"/") eq request.sitecontext.dsn){
//if it is, take it off...
sThisPage = replaceNoCase(sThisPage,"/#request.sitecontext.dsn#","");
}
//Find if there is a page in the DB
qThisPage = oPages.get(page_ssurl = sThisPage);
if(qThisPage.recordCount){
//if we find the page, write the SSURL file oTree.CreateSSURLPage(
parent_circuit_uuid=qThisPage.circuit_uuid,
page_uuid=qThisPage.uuid,
sitename=request.siteContext.dsn,
updateDB=true
);
sRelocate = "/#request.sitecontext.dsn#/#sThisPage#";
}
}
</cfscript>
<cflocation url="#sRelocate#" addtoken="false">
Comments
There are no comments for this page as yet.
print page
