Completely remove index.cfm

I have a working version of contentbox. I have enabled url rewrite and all works great.
But I have a question: it’s possible to completely remove index.cfm from url?

I explain better. Right now my url are displayed as but this page works also if the url is

I’d like to have a 301 redirect from to

Is this possible? I have not much knoweledge about htaccess and url rewriting. Will something like this work?


RewriteEngine on
#RepeatLimit 0

#I redirect all request to url without index.cfm

RewriteRule ^/index.cfm/?(.*)$ /$1 [R=301,L]

#if this call related to adminstrators or non rewrite folders, you can add more here.
RewriteCond %{REQUEST_URI} ^/(.(CFIDE|cfide|CFFormGateway|jrunscripts|railo-context|mapping-tag|fckeditor)).$
RewriteRule ^(.*)$ - [NC,L]

#dealing with flash / flex communication
RewriteCond %{REQUEST_URI} ^/(.(flashservices|flex2gateway|flex-remoting)).$
RewriteRule ^(.*)$ - [NC,L]

#font awesome
AddType application/ .eot
AddType font/ttf .ttf
AddType font/otf .otf
AddType font/woff .woff
<FilesMatch “.(ttf|otf|eot|woff)$”>

Header set Access-Control-Allow-Origin “*”

Media Types

RewriteCond %{REQUEST_URI} /__media/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.cfm/%{REQUEST_URI} [QSA,L,NS]

#Images, css, javascript and docs, add your own extensions if needed.
RewriteCond %{REQUEST_URI} .(bmp|gif|jpe?g|png|css|js|txt|xls|ico|swf)$
RewriteRule ^(.*)$ - [NC,L]

#The ColdBox index.cfm/{path_info} rules.
RewriteRule ^$ index.cfm [QSA,NS]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.cfm/%{REQUEST_URI} [QSA,L,NS]


Thanks, Brad.

I know user will never seen those links. But I want Google and other search engine not see the urls.

On my local machine if I put apache in front of alucee server with tuckey rewrite enable the redirection works. So I was asking if someone has some suggestion…

From a SEO perspective, a competitor can put some links with index.cfm and make google index it.
So there will be two url pointing to same page and it will generate duplicate content for search engine.

I’m just asking if there is a way to avoid this…

Seems like a dubious use case, but I don’t see why a 301 redirect like you show wouldn’t work. Have you tried it? What happened?



ColdBox Platform Evangelist
Ortus Solutions, Corp

ColdBox Platform:

I got a 301 redirect loop. Probably the only solution is to add a tuckey rewrite, as in commandbox. I will try to post in lucee group to see if someone has suggestions.


One way to accomplish what you are trying to do, is to rename the index.cfm file to something else, like mysupersecretindex.cfm. Then you update the rewrite rules to redirects to this new file instead of index.cfm. Next, you would create an additional rule that redirects requests made specifically to index.cfm back to the root of the site, like this:

Redirect calls to index.cfm

RewriteRule ^index.cfm / [L,R=301,NC]

Finally, you would need to modify your webserver’s default document to point to mysupersecretindex.cfm.

I just tested it and it seems to work fine. Your results may vary.