Last active
December 14, 2023 10:04
-
-
Save stevewithington/637e62d7db7b8943cf6b67153231ed0e to your computer and use it in GitHub Desktop.
Mura CMS: 404 Redirect Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
public any function onSite404(m) { | |
if (m.event('currentFilenameAdjusted') == 'some/bad-url') { | |
// If you want to preserve the requested URL ... | |
// var cb = m.getBean('content').loadBy(filename='some/good-url'); | |
// m.setContentBean(cb); | |
// If you want to redirect to the new URL ... | |
location(url=arguments.m.createHREF(filename='some/good-url'), addtoken=false); | |
} | |
} | |
</cfscript> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment