Completely remove index.cfm

119 views
Skip to first unread message

Francesco Pepe

unread,
May 8, 2016, 2:53:52 PM5/8/16
to ContentBox Modular CMS
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 www.mysite.com/my-page but this page works also if the url is  www.mysite.com/index.cfm/my-page.

I'd like to have a 301 redirect from mysite.com/index.cfm/my-page to mysite.com/my-page.

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/vnd.ms-fontobject .eot
AddType font/ttf .ttf
AddType font/otf .otf
AddType font/woff .woff
<FilesMatch "\.(ttf|otf|eot|woff)$">
  <IfModule mod_headers.c>
    Header set Access-Control-Allow-Origin "*"
  </IfModule>
</FilesMatch>

# 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]


Brad Wood

unread,
May 8, 2016, 3:51:53 PM5/8/16
to conte...@googlegroups.com
Edit your config/routes.cfm file and remove the index.cfm from there. That base url to used to build all links in the site.

You can't keep your server from also responding to urls with the index.cfm because the web server actually always sees it. It's a requirement to make the connector pass the requests to CF. As long as all urls are being built without the index.cfm as I described above, it should be ok since a user would never see it unless they typed it themselves.


Happy Connecting. Sent from my Sprint Samsung Galaxy S® 5
--
--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
For News, visit http://www.gocontentbox.org/blog
For Bug Reports, visit https://ortussolutions.atlassian.net/browse/CONTENTBOX
---
You received this message because you are subscribed to the Google Groups "ContentBox Modular CMS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to contentbox+...@googlegroups.com.
To post to this group, send email to conte...@googlegroups.com.
Visit this group at https://groups.google.com/group/contentbox.
For more options, visit https://groups.google.com/d/optout.

Francesco Pepe

unread,
May 8, 2016, 3:58:40 PM5/8/16
to ContentBox Modular CMS
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...

Brad Wood

unread,
May 8, 2016, 4:16:29 PM5/8/16
to conte...@googlegroups.com

I guess I don't understand what you're asking then. Where are you (or Google) seeing these links?  As long as you've removed the index.cfm from your routes.cfm, you shouldn't ever see that file again.


Happy Connecting. Sent from my Sprint Samsung Galaxy S® 5


-------- Original message --------
From: Francesco Pepe <sgozz...@gmail.com>
Date: 5/8/16 2:58 PM (GMT-06:00)
To: ContentBox Modular CMS <conte...@googlegroups.com>

Francesco Pepe

unread,
May 8, 2016, 5:28:54 PM5/8/16
to ContentBox Modular CMS
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...


Il giorno domenica 8 maggio 2016 20:53:52 UTC+2, Francesco Pepe ha scritto:

br...@bradwood.com

unread,
May 8, 2016, 7:11:17 PM5/8/16
to conte...@googlegroups.com
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?

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: br...@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com 
 
 
--------- Original Message ---------
Subject: [contentbox-version] Re: Completely remove index.cfm
From: "Francesco Pepe" <sgozz...@gmail.com>
Date: 5/8/16 4:28 pm
To: "ContentBox Modular CMS" <conte...@googlegroups.com>

--

Francesco Pepe

unread,
May 21, 2016, 9:39:28 AM5/21/16
to ContentBox Modular CMS
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.

Dean Lawrence

unread,
May 27, 2016, 4:48:14 PM5/27/16
to ContentBox Modular CMS
Francesco,

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.
--
Dean Lawrence
President
Internet Data Technology
Reply all
Reply to author
Forward
0 new messages