I’ve enabled url rewriting and selected a xml file for custom rules. Here’s my server.json:
and my XML:
<?xml version="1.0" encoding="utf-8"?>
Does anything stand out? Hitting /about doesn’t load up my about.cfm page.
Hi Ray, your issue is that my docs were wrong on that! The actual rewrite config is supposed to be inside a “web” object like so:
Or via the “server set” commands:
server set web.rewrites.enable=true
server set web.rewrites.config=customRewrites.xml
I just tested this and it works. Sorry for the confusion-- I’ll update the docs right now to make sure they all include the “web” bit in there.
Also, I noticed you had an extra cfengine property at the top level. It’s not hurting anything, but it’s extraneous. You can get rid of it with “server clear cfengine” (or just edit the server.json file!)
ColdBox/CommandBox Developer Advocate
Ortus Solutions, Corp
ColdBox Platform: http://www.coldbox.org
Woot! Thank you. Quick follow up - 2 actually.
We should expect to have to stop/start Box on every change, right? Or just changes to the server.json file?
Using the rewrite in the XML you saw above, I can request /about, but in the browser, it shows /about.cfm. How do I prevent that? I want it to stay as /about
Ok, I believe I answered both questions. To keep the URL nice and clean, use passthrough for the type.
Also - I noticed that when I changed my XML, it was NOT updated in my Lucee server. That’s kind of annoying, but I can live with it I suppose.