iBrightDev
November 30th, 2009, 17:06
ok, so, i am doing a site in coldfusion, but, the typical .htaccess mod_rewrite doesnt work. from what i have found so far on the web, i need a file named urlrewrite.cml and place it in my WEB-INF folder that has the following contents...
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 2.6//EN"
"http://tuckey.org/res/dtds/urlrewrite2.6.dtd">
<urlrewrite>
<rule enabled="true">
<from>^/page/([a-z]+)$</from>
<to>/index.cfm?page=$1</to>
</rule>
<outbound-rule>
<from>^/index.cfm?page=([a-z]+)$</from>
<to>/page/$1</to>
</outbound-rule>
</urlrewrite>
then it also needs to have the following code added to the web.xml file in the WEB-INF folder...
<filter>
<filter-name>UrlRewriteFilter</filter-name>
<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>UrlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
i cant get this to work though. what i have for the url i am trying to go to is...
http://ibrightdev:8500/hookspot/page/index
the original url would be...
http://ibrightdev:8500/hookspot/index.cfm?page=index
index would be the name od the page, so, if i am on the about page, it would need to be...
http://ibrightdev:8500/page/about
i get a 404 error though...
404
/hookspot/page/main
java.io.FileNotFoundException: /hookspot/page/main
at jrun.servlet.file.FileServlet.service(FileServlet.java:356)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:86)
at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter( UrlRewriteFilter.java:738)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
at jrun.servlet.FilterChain.service(FilterChain.java:101)
at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)
at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.ja va:42)
at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatc her.java:286)
at jrun.servlet.ServletEngineService.dispatch(ServletEngineServ ice.java:543)
at jrun.servlet.http.WebService.invokeRunnable(WebService.java: 172)
at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable( ThreadPool.java:320)
at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(Thr eadPool.java:428)
at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(Th readPool.java:266)
at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
anyone familiar with doing a mod_rewrite with coldfusion? any help is much appreciated.
**EDIT**
if it helps, here is how im getting the page content to appear...
<cfset templatepath = "template/" >
<cfif isDefined("url.page")>
<cfset pageurl= templatepath & url.page & ".cfm">
<cfelse>
<cfset pageurl= templatepath & "index.cfm">
</cfif>
<cfinclude template="#pageurl#">
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 2.6//EN"
"http://tuckey.org/res/dtds/urlrewrite2.6.dtd">
<urlrewrite>
<rule enabled="true">
<from>^/page/([a-z]+)$</from>
<to>/index.cfm?page=$1</to>
</rule>
<outbound-rule>
<from>^/index.cfm?page=([a-z]+)$</from>
<to>/page/$1</to>
</outbound-rule>
</urlrewrite>
then it also needs to have the following code added to the web.xml file in the WEB-INF folder...
<filter>
<filter-name>UrlRewriteFilter</filter-name>
<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>UrlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
i cant get this to work though. what i have for the url i am trying to go to is...
http://ibrightdev:8500/hookspot/page/index
the original url would be...
http://ibrightdev:8500/hookspot/index.cfm?page=index
index would be the name od the page, so, if i am on the about page, it would need to be...
http://ibrightdev:8500/page/about
i get a 404 error though...
404
/hookspot/page/main
java.io.FileNotFoundException: /hookspot/page/main
at jrun.servlet.file.FileServlet.service(FileServlet.java:356)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:86)
at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter( UrlRewriteFilter.java:738)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
at jrun.servlet.FilterChain.service(FilterChain.java:101)
at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)
at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.ja va:42)
at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatc her.java:286)
at jrun.servlet.ServletEngineService.dispatch(ServletEngineServ ice.java:543)
at jrun.servlet.http.WebService.invokeRunnable(WebService.java: 172)
at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable( ThreadPool.java:320)
at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(Thr eadPool.java:428)
at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(Th readPool.java:266)
at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
anyone familiar with doing a mod_rewrite with coldfusion? any help is much appreciated.
**EDIT**
if it helps, here is how im getting the page content to appear...
<cfset templatepath = "template/" >
<cfif isDefined("url.page")>
<cfset pageurl= templatepath & url.page & ".cfm">
<cfelse>
<cfset pageurl= templatepath & "index.cfm">
</cfif>
<cfinclude template="#pageurl#">