Hi, I’m trying (and failing) to locate and setup URL rewrites to mirror my live server for local dev. Does anyone have an insight?
I’m following the instructions here:
And starting the system with:
–rewritesEnable --rewritesConfig=urlrewrite.xml
Don’t forget to tell us about your stack!
OS: OS X 12.7.2
Java Version: 11.0.19 (Homebrew)
CommandBox Version: 6.1.0+00813
Lucee Version: 5.4.6.9 stable (Gelert)
This is my config, it works for me:
server.json:
{
"name":"app-name",
"web":{
"rewrites":{
"enable":true,
"config":"config/urlrewrite.xml"
}
}
}
Files position:
/server.json
/config/urlrewriting.xml
HTH
1 Like
Thanks, I ended up doing this:
I found the simplest way for me to implement was in the myservername.json that is in my web root.
This is for a url formatted like this:
/news/2025/02/14/my-slug-friendly-headline/
the second example is there to show that you can add lines - I’m sure there are more fancy ways to do it but for local testing it was sufficient.
{
"name":"myservername",
"rewritesConfig=urlrewrite.xml":true,
"rewritesEnable":true,
"urlrewrites":true,
"web":{
"rules":[
"path-template( '/news/{y}/{m}/{d}/{s}/' ) -> rewrite( '/news/news.cfm?mode=singleitem&year=$y&month=$m&day=$d&slug=$s' )",
"path-template( '/podcast' ) -> rewrite( '/video/index.cfm?keyword=Podcast:' )"
]
}
}
Hope it helps someone
2 Likes