NOTICE: We are now using the Mura CMS Developer's Google Group for our Forum. While you can no longer post messages here, this forum will remain archived but unmonitored. Other support options are available here.

Next Page

Page: 1

Previous Page

Thread: How do I remove index.cfm from URL? (Apache)

Created on: 01/26/09 07:05 AM

Replies: 25

barledge





Joined: 01/26/09

Posts: 3

How do I remove index.cfm from URL? (Apache)
01/26/09 7:05 AM

I'm using Sava CMS with Apache and am looking for a way to change the standard URL from http://www.site.com/index.cfm/pagename/ to http://www.site.com/pagename

I've made this work with IIS but not having any luck with Apache. Can anyone give me any insight as to how I can do this?

Thanks!
Ben

Link | Top | Bottom

tonyg



tonyg's Gravatar

Joined: 05/09/08

Posts: 177

RE: How do I remove index.cfm from URL? (Apache)
02/03/09 8:38 AM
Attachment: htaccess.txt

Ben,
With Apache, you need to use the mod_rewrite module. So first, you need to make sure that mod_rewrite is enabled on your webserver. Here is a page that with some instructions on how to do that. There's lots of info to be had about mod_rewrite by just Googling around.
Then you need to upload an .htaccess file containing your mod_rewrite rules in the webroot of your Sava install. Attached is the .htaccess file I use (make sure you rename it to ".htaccess").
Make sure you restart your Apache server if you needed to modify your httpd.conf file to enable mod_rewrite.
At this point, pointing your browser to http://site.com/pagename should work. However, the links created by Sava still have the "index.cfm". To remedy this, modify the getURLStem method in your [siteID]/includes/contentRenderer.cfc:

change this line:

<cfreturn "/index.cfm" & "/" & arguments.filename & "/"/>

to

<cfreturn "/" & arguments.filename & "/"/>

That should do it. Good luck!

__________________

objectivebias.com

Link | Top | Bottom

Sean



Sean's Gravatar

Joined: 03/13/08

Posts: 1699

RE: How do I remove index.cfm from URL? (Apache)
02/03/09 8:47 AM

Great post, Tony. Thanks for pitching in!

=================================
Sean Schroeder
Team Mura
Blue River Interactive Group

Link | Top | Bottom

barledge





Joined: 01/26/09

Posts: 3

RE: How do I remove index.cfm from URL? (Apache)
02/03/09 12:48 PM

Yes, great reply! Thanks Tony!

Link | Top | Bottom

tonyg



tonyg's Gravatar

Joined: 05/09/08

Posts: 177

RE: How do I remove index.cfm from URL? (Apache)
02/04/09 3:08 AM

My pleasure, guys. It's just my way of giving back!

__________________

objectivebias.com

Link | Top | Bottom

andrewteg



andrewteg's Gravatar

Joined: 03/16/09

Posts: 36

RE: How do I remove index.cfm from URL? (Apache)
04/29/09 1:40 AM

Does anyone know a way to modify this if installing Mura in a subfolder? I added RewriteBase /folder and that runs the homepage OK but gives a 404 for the rest. It's appending the folder at the end so it's rewriting to:
domain.com/folder/index.cfm/folder/page/
instead of
domain.com/folder/index.cfm/page/

I just can't find the right syntax yet...

Link | Top | Bottom

matt





Joined: 04/26/08

Posts: 3674

RE: How do I remove index.cfm from URL? (Apache)
04/29/09 6:18 AM

Have you tried theses instuctions?

http://www.gosava.com/sava/forum/messages.cfm?threadid=AAF813A1-9012-90F5-C302FC251D956C2B#2

=================================
Matt Levine
Team Mura
Blue River Interactive Group

Link | Top | Bottom

andrewteg



andrewteg's Gravatar

Joined: 03/16/09

Posts: 36

RE: How do I remove index.cfm from URL? (Apache)
04/29/09 6:25 AM

Yea, I did that. I actually have Mura installed in a sub-folder on the domain so it was originally serving pages as domain.com/folder/default/index.cfm/page/ and I used that thread to remove /default and am trying to remove /index.cfm as well now.

Link | Top | Bottom

matt





Joined: 04/26/08

Posts: 3674

RE: How do I remove index.cfm from URL? (Apache)
04/29/09 7:24 AM

What servlet container are you using?

You may be using a servlet container that does not support two sided wildcard mappings. This means that anything after the index.cfm will just cause a 404. This is what the FriendlyURLSErvlet is for. Unfortunately the FriendlyURLServlet only works when Mura is installed in the webroot.

=================================
Matt Levine
Team Mura
Blue River Interactive Group

Link | Top | Bottom

andrewteg



andrewteg's Gravatar

Joined: 03/16/09

Posts: 36

RE: How do I remove index.cfm from URL? (Apache)
05/14/09 3:33 AM

Ah, kinda lost track of this thread and didn't see the response Matt. Thanks!

I'm not exactly sure what servlet container it's using. It's just a standard MX7 install on Windows Server 2003 with Apache. I enabled mod_rewrite on Apache but I'm not too sure what else you need to know. Sorry 'bout that.

Thanks,
Andrew

Link | Top | Bottom

jamiekrug



jamiekrug's Gravatar

Joined: 05/19/09

Posts: 45

RE: How do I remove index.cfm from URL? (Apache)
05/21/09 3:32 AM

@Andrew,

It sounds like you just need to tweak your mod_rewrite rules slightly. If you used Tony's example, you will have the problem you're seeing, because the final rule is something like this in Tony's sample .htaccess:

RewriteRule ^(.*)$ index.cfm%{REQUEST_URI}

The REQUEST_URI server variable contains that leading /folder in your example, so you'll probably want something more like this for that particular rewrite:

RewriteRule ^folder(.*)$ folder/index.cfm$1

If you post some more details, I may be able to help. Are you adding rewrite rules inside a VirtualHost config, or in an .htaccess file? If .htaccess, is it in your Web root or in the Mura subfolder ("folder" in your examples)?

Also, FWIW, if you have a standard install of Adobe CF, your servlet container is probably JRun.

Best,
Jamie

Link | Top | Bottom

andrewteg



andrewteg's Gravatar

Joined: 03/16/09

Posts: 36

RE: How do I remove index.cfm from URL? (Apache)
06/19/09 2:17 AM

Thanks Jamie. I was putting htaccess in the mura subfolder (folder) and ended up using these rewrite rules (borrowing from Drupal) and they seem to work great!

<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteBase /folder
  # Rewrite URLs of the form 'x' to the form 'index.cfm/x'.
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !=/favicon.ico
  RewriteRule ^(.*)$ index.cfm/$1 [L,QSA]
</IfModule>

Link | Top | Bottom

8riaN



8riaN's Gravatar

Joined: 07/17/09

Posts: 66

RE: How do I remove index.cfm from URL? (Apache)
08/11/09 1:09 PM

Note to Windows users:
You can use the above instructions as written with IIS Mod-Rewrite Pro, but the half-price standard version doesn't support .htaccess files, so REQUEST_FILENAME still has the original URL in it, not the mapped path. You can compensate in the general setup file (using <VirtualHost www.mydomain.com> for domain level control if you like) by adding the physical path to the webroot, like this:
<VirtualHost www.mydomain.com>
RewriteCond c:/inetpub/wwwroot%{REQUEST_FILENAME} -f [OR]
RewriteCond c:/inetpub/wwwroot%{REQUEST_FILENAME} -d
RewriteRule . - [L]

...
</VirtualHost>

P.S. IIS Mod-rewrite is available here: http://www.micronovae.com/ModRewrite/Download.html
At the time of writing it was $150 for Pro and $75 for Standard.
DL is free. Limitations are: unlimited from localhost, 30 minutes or 1000 requests every time you restart IIS for requests originating all other IPs. No feature restrictions.

P.P.S. I have no connection with Micro Novae beyond deciding just now to become their customer 'cause their product works well, and their tech support responds fast to web tickets :)
* Last updated by: 8riaN on 8/11/2009 @ 8:10 PM *

Link | Top | Bottom

jamiekrug



jamiekrug's Gravatar

Joined: 05/19/09

Posts: 45

RE: How do I remove index.cfm from URL? (Apache)
08/19/09 3:34 AM

Note to Windows users: Apache is fast, free and incredibly stable, and it runs on Windows too! LOL :) Just my 2 cents, but I spent years managing IIS servers before switching to Apache. I was incredibly happy to run Apache (on Windows at first, now Linux) to easily manage multiple servers and development environments. It's super easy and quick to replicate between servers, plus mod_rewrite and much more is also freely available. Again, just my 2 cents, but had to throw this out there ;-)

Link | Top | Bottom

envidobi



envidobi's Gravatar

Joined: 03/01/09

Posts: 277

RE: How do I remove index.cfm from URL? (Apache)
08/26/09 2:45 PM

Hi,
i've tried but to with no success to get to this to work. I got:
- Tony's htaccess file, confirmed that it didn't have .txt after it
- put the file in the root of mura (which i'm assuming is the same directory where admin, config, and the rest of MURA folders are
- changed the path in contentrenderer
- restart apache a bunch of times

But still i get nothing but 404 errors when i try to go to mydomain/firstSection/.

I'm using Apache 2, with rewrites turned on. I"m on a SlackWare (Linux) box, and i'm using Open BlueDragon (which i can't see would have anything to do with the rewrites).
Anyone have any thoughts?
Thanks,
David

Link | Top | Bottom

tonyg



tonyg's Gravatar

Joined: 05/09/08

Posts: 177

RE: How do I remove index.cfm from URL? (Apache)
08/26/09 3:19 PM

When you rename the htaccess.txt, it's not enough to just remove the ".txt" at the end. you also have to add a period at the beginning. So the file should be named ".htaccess"
Is that how you named it?

__________________

objectivebias.com

Link | Top | Bottom

envidobi



envidobi's Gravatar

Joined: 03/01/09

Posts: 277

RE: How do I remove index.cfm from URL? (Apache)
08/26/09 5:00 PM

Yes. i have it as .htaccess and in my linux directory in filezilla is see it as type HTACCESS. Some weird stuff is going on with Mura. I mean when i do a search it won't work on any page but the home page. Thats on top of the URL SES problem.
Really appreciate the help! :)

Link | Top | Bottom

jamiekrug



jamiekrug's Gravatar

Joined: 05/19/09

Posts: 45

RE: How do I remove index.cfm from URL? (Apache)
08/27/09 4:08 AM

David, which servlet container are you using to run OpenBD (e.g., Tomcat)? I'd suggest you test browsing directly, without Apache, first (e.g., w/Tomcat it would be something like mydomain:8080/index.cfm/firstSection/).

Also, some servlet containers (Tomcat) do not handle the common CFML SES URL formats "out of the box." Check out this post by Sean Corfield:
http://corfield.org/entry/Railo_for_Dummies_Part_V

Do you know if the 404 error is coming from Apache or your servlet container? If Apache, then your rewrite rules are not working at all. If servlet container, then it's probably the SES URL support I just mentioned.

HTH!

Link | Top | Bottom

envidobi



envidobi's Gravatar

Joined: 03/01/09

Posts: 277

RE: How do I remove index.cfm from URL? (Apache)
08/27/09 7:45 AM

The 404 is coming from Tomcat.i took a look at Sean's article, but am still a little confused as to where to put that URL-Pattern as there is already one in web.xml of the web-inf of my site's root. Same folder that has bluedragon in it.

Link | Top | Bottom

jamiekrug



jamiekrug's Gravatar

Joined: 05/19/09

Posts: 45

RE: How do I remove index.cfm from URL? (Apache)
08/27/09 8:01 AM

Can you post your web.xml file here, to look at? You probably just need to add another servlet-mapping.

Also, how are you connecting Apache to Tomcat -- AJP proxy/rewrite or mod_jk?

You could also take a look at your Tomcat logs, to see if there's anything interesting there. You can also temporarily turn on more verbose Apache rewrite logging, to ensure that URLs are properly rewritten before getting to Tomcat (see Apache httpd docs for rewrite logging stuff).

Link | Top | Bottom

envidobi



envidobi's Gravatar

Joined: 03/01/09

Posts: 277

RE: How do I remove index.cfm from URL? (Apache)
08/27/09 8:10 AM

Mod_jk

Web.xml from Web-Inf


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<!--

Uncomment the configuration of this filter in order to support search engine
friendly URLs like http://127.0.0.1/bdj2eeregr/index.cfm/path/info.
-->
<filter>
<filter-name>SearchEngineFriendlyURLFilter</filter-name>
<display-name>SearchEngineFriendlyURLFilter</display-name>
<description>SearchEngineFriendlyURLFilter</description>
<filter-class>com.newatlanta.filters.SearchEngineFriendlyURLFilter</filter-class>
<init-param>
<param-name>extensions</param-name>
<param-value>cfm,cfml</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>SearchEngineFriendlyURLFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

<listener>
<listener-class>com.naryx.tagfusion.cfm.application.cfHttpSessionListener</listener-class>
</listener>
<servlet>
<servlet-name>cfmServlet</servlet-name>
<description>BlueDragon CFML Engine</description>
<servlet-class>com.naryx.tagfusion.cfm.cfServlet</servlet-class>
<init-param>
<param-name>BLUEDRAGON_WORKING_DIRECTORY</param-name>
<param-value>/WEB-INF/bluedragon/work</param-value>
</init-param>
<init-param>
<param-name>BLUEDRAGON_XML</param-name>
<param-value>/WEB-INF/bluedragon/bluedragon.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>cfcServlet</servlet-name>
<description>BlueDragon CFC Servlet</description>
<servlet-class>com.naryx.tagfusion.cfm.cfcServlet</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet>
<servlet-name>cfchartServlet</servlet-name>
<servlet-class>com.naryx.tagfusion.cfm.cfchartServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>cfmServlet</servlet-name>
<url-pattern>*.cfm</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>cfcServlet</servlet-name>
<url-pattern>*.cfc</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>cfchartServlet</servlet-name>
<url-pattern>*.cfchart</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
<mime-mapping>
<extension>txt</extension>
<mime-type>text/plain</mime-type>
</mime-mapping>
<mime-mapping>
<extension>pdf</extension>
<mime-type>application/pdf</mime-type>
</mime-mapping>
<mime-mapping>
<extension>swf</extension>
<mime-type>application/x-shockwave-flash</mime-type>
</mime-mapping>
<mime-mapping>
<extension>gif</extension>
<mime-type>image/gif</mime-type>
</mime-mapping>
<mime-mapping>
<extension>jpeg</extension>
<mime-type>image/jpeg</mime-type>
</mime-mapping>
<mime-mapping>
<extension>svg</extension>
<mime-type>image/svg+xml</mime-type>
</mime-mapping>
<mime-mapping>
<extension>html</extension>
<mime-type>text/html</mime-type>
</mime-mapping>
<mime-mapping>
<extension>xml</extension>
<mime-type>text/xml</mime-type>
</mime-mapping>
<mime-mapping>
<extension>htm</extension>
<mime-type>text/html</mime-type>
</mime-mapping>
<mime-mapping>
<extension>jpg</extension>
<mime-type>image/jpeg</mime-type>
</mime-mapping>
<mime-mapping>
<extension>css</extension>
<mime-type>text/css</mime-type>
</mime-mapping>
<welcome-file-list>
<welcome-file>index.cfm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
</welcome-file-list>
</web-app>

Link | Top | Bottom

jamiekrug



jamiekrug's Gravatar

Joined: 05/19/09

Posts: 45

RE: How do I remove index.cfm from URL? (Apache)
08/27/09 8:42 AM

I don't know much about that OpenBD "SearchEngineFriendlyURLFilter" but Matt Woodward does have a word of caution about it here.

To try out the method I mentioned, comment out that whole filter block for SearchEngineFriendlyURLFilter and then add a servlet-mapping just after the *.cfm one:

<servlet-mapping>
	<servlet-name>cfmServlet</servlet-name>
	<url-pattern>/index.cfm/*</url-pattern>
</servlet-mapping>

Or, if you have Mura running in a subdirectory beneath your Web root (e.g., host/mura/index.cfm):

<servlet-mapping>
	<servlet-name>cfmServlet</servlet-name>
	<url-pattern>/mura/index.cfm/*</url-pattern>
</servlet-mapping>

Finally, keep in mind that, by default, Mura will redirect to your siteid (e.g., by default it's host/default/index.cfm/sample-page/). If using default, just change my second example above to a url-pattern of /default/index.cfm/* and make sure you have the /index.cfm/* also, for the home page.

I'm still curious to know if it works without apache (http://yourhost:8080/index.cfm)?

Link | Top | Bottom

envidobi



envidobi's Gravatar

Joined: 03/01/09

Posts: 277

RE: How do I remove index.cfm from URL? (Apache)
08/27/09 6:10 PM

Still not working. I've tried just about everything i could. I talked to Matt Woodward about it, and he's going to test a few things so hopefully we can get a fix here shortly for those of us that can't get it to work correctly using mod_jk and tomcat with Open BD.

On a different note, as a newbie to Mura, i've noticed that there are a few funky things that are going on in regards to URLs. The first is the fact that when i do a search, i can't actually change it to use a different page. I've tried a workaround that was suggested in other posts, but no go. Also, when i try to search using the default settings(which show results on the index page) it works fine when on the index page, but doesn't work for the subsequent pages, even when i use #renderer.dspBody(body=request.contentBean.getbody(),pageTitle="",crumbList=0,showMetaImage=0)#. If i'm on any page but the home page, it just sends you to the same page your on, without any results. Any ideas of why this is?

Second issue is in regards to testing remotely. If i don't point my domain, i have to always change my hosts file, even after making an alias in Vhosts that would actually send me to the right place. I think this has to do with the site settings.

And third, and sorry for the rant, is the default location for files that get uploaded by the users via the WYSIWYG editor in the Admin. I've tried to change this serveral times, but always adds a Default/Assets to the choice.

Anyways, i've left these same posts in other posts, but still hadn't gotten replies, so i figured i'd put them here to see if maybe they'd be answered on this post.

Thanks again,
David

Link | Top | Bottom

rawknee



rawknee's Gravatar

Joined: 04/11/09

Posts: 279

RE: How do I remove index.cfm from URL? (Apache)
01/23/10 10:03 AM

@ Ben -

You said you've gotten this to work in IIS... Can you post the instructions for using IIS6 on Windows 2003?

Thanks!

Mura Sites Developed:
www.themodmedia.com (my company)
www.whiteribbonalliance.org
www.blanketbooster.com
www.onyxmd.com
www.bpmnw.com
www.membership-consultants.com
www.ceba.org

Link | Top | Bottom

barledge





Joined: 01/26/09

Posts: 3

RE: How do I remove index.cfm from URL? (Apache)
01/25/10 12:29 PM

Removing index.cfm from the URL should be the same for Apache and IIS.

http://www.getmura.com/forum/messages.cfm?threadid=15306417-FC5E-DF88-7F6DCD30F1C8A10C&page=1#2

Ben

Link | Top | Bottom

jamiekrug



jamiekrug's Gravatar

Joined: 05/19/09

Posts: 45

RE: How do I remove index.cfm from URL? (Apache)
01/26/10 2:04 AM

Ben,

Are you talking about the Web server level, or the Mura code change? The minor code changed in Mura to remove usage of index.cfm from URLs is identical regardless of Web server, servlet container or CFML engine. The URL rewrite on the other hand...

The act of "removing index.cfm from the URL" requires URL rewriting. This has nothing to do with Mura or any CFML engine, but rather it is a function of the Web server (i.e., Apache or IIS). Apache allows you to easily enable mod_rewrite. IIS has a variety of third-party products that handle URL rewriting, and some of them even allow for the same syntax as mod_rewrite through use of .htaccess files. Beyond that, you'll have to get Microsoft and the Apache Foundation to coordinate efforts ;-)

Jamie

Link | Top | Bottom

Next Page

Page: 1

Previous Page