Monday, 1 October 2012

CMS8 Path stuff finally sorted!

Finally reached a workable solution to the web.config pathing problem. I created a module, built into the cms8 dll that sorts out what requests will be sent to the page processor.

Usage is this:

<system.webServer>
    <modules><add name="CMS8Module" type="CMS8.CMS8Module" /></modules>
</system.webServer>

Now if the module is used all extentioned pages (e.g. .htmx) and path type pages (e.g. /about-us/) will be handled by CMS8.Requester2, with the admin section being ignored (as long as the CMS8Config.Adminsite key is set to true and the CMS8Config.ApplicationVPath key is correct). Also htm and aspx files will be ignored by the CMS8 dll.

However this means that 404 errors for .Net and non-.Net resources will need to be caught - here are the settings:

<system.web>
<customErrors mode="On"><error redirect="/404.html" statusCode="404" /></customErrors>
</system.web>

<system.webServer>
<httpErrors errorMode="Custom">
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" prefixLanguageFilePath="" path="/404.html" responseMode="ExecuteURL" />
</httpErrors>
</system.webServer>

The "publish 404" function now creates a 404.html as well as the 404.inc files

So in total RequestHandler  can still be used, this silently redirects "/about-us.htmx" pages to "/about-us/" pages WITHOUT 301. Requester will silently redirect in the same way WITH a 301 redirect.#

Requester2 does not do the Page_PreInit to check for "Sitemap.xml" or "robots.txt" and also does not do the redirects for "/about-us.htmx" pages to "/about-us/" pages.

The way forward is the Module + Requester2 way.

No comments:

Post a Comment