Hi All,
I want to use CommandBox as my development platform, however to do so I need to be able to convert my existing Apache HTTPD rewrite rules into Tuckey ones. The rewrites are pretty simple and are just for SES URL’s. I looked it up in the CommandBox Gitbook and read the following page:
http://ortus.gitbooks.io/commandbox-documentation/content/embedded_server/url_rewrites.html
I copied the “foo” example from the page into my working directory into a file called customRewrites.xml and then started the CommandBox built in server using the following command:
start --rewritesEnable rewritesConfig=customRewrites.xml
The example works as expected.
I then stop the server and replaced the “foo” example with the following:
`
<?xml version="1.0" encoding="utf-8"?>
^news/([^/]+)
/index.cfm?action=content.news&article=$1
^/(.+)$
/index.cfm/$1
`
I started the server again in the same way, however when I go to any URL that is not the index page all I get is a message saying “Not found” and it appears to ignore the rewrite rules.
Anyone got any ideas what I have done wrong?
Thanks.
Kind regards,
Andrew.
Try adding the leading slash, so instead of
^news/([^/]+)
you have
^/news/([^/]+)
Also, check out the docs on this page for setting up logging:
http://urlrewritefilter.googlecode.com/svn/trunk/src/doc/manual/4.0/index.html#filterparams
<!-- sets up log level (will be logged to context log)
can be: slf4j, TRACE, DEBUG, INFO (default), WARN, ERROR, FATAL,
sysout:{level} (ie, sysout:DEBUG)
if you are having trouble using normal levels use sysout:DEBUG
(default WARN) -->
<init-param>
<param-name>**logLevel**</param-name>
<param-value>DEBUG</param-value>
</init-param>
Thanks!
~Brad
ColdBox Platform Evangelist
Ortus Solutions, Corp
E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com
Adding the leading slash doesn’t help. Will try the logging later.
Hi Brad,
Actually found some time to look at this further and found the problem. In the rule I had and ampersand (&) which of course in XML has to be escaped with & and it wasn’t, so the XML was not valid and the custom file was not being loaded. Replaced the & with & and it is working fine now.
Glad to hear you got this sorted. I was actually wondering earlier today if you ever made any progress on it.
Thanks!
~Brad
ColdBox Platform Evangelist
Ortus Solutions, Corp
E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com