Skip to main content
August 19, 2010
Question

Problem with CF9, Apache2 and aliases (mod_alias)

  • August 19, 2010
  • 1 reply
  • 1536 views

Hi

We're running ColdFusion9 with Apache 2 and want to access .cfm files without specifying any extensions. This used to work with CF5 (don't ask... ^^) and Apache1.3.x.

Here's a simple example with two aliases for accessing the administrator pages of ColdFusion:

Entries in httpd.conf:

    Alias /Admin        "/usr/local/httpd-2.2.16/htdocs/CFIDE/administrator/index.cfm"

    Alias /Admin.cfm    "/usr/local/httpd-2.2.16/htdocs/CFIDE/administrator/index.cfm"

When accessing the page with http://localhost/Admin.cfm, everything works fine.

When accessing the page with http://localhost/Admin though, we get 403 (Forbidden), and that's it.

It seems, that JRun looks at the extension of the original request (that is, before the alias mapping takes place) in order to find out whether it has to forward the request to the CF server or not. But we can't specify a nonexisting extension to the AddHandler-clause.

Is there any way make this work?

Using redirects instead of aliases works, but a redirect involves the client which is inacceptable since it would double the #requests.

Kind regards!

Daniel

    This topic has been closed for replies.

    1 reply

    Participating Frequently
    August 19, 2010
    August 19, 2010

    Hm.. your reply seems to be empty, mack_! I hope this doesn't mean that it's not possivle.

    Regards

    Daniel

    August 20, 2010

    I'm using mod_rewrite with ColdFusion and PHP on quite a number of

    sites and it works perfectly so I think there's something in your

    setup that generates the 403 message. Does the user ColdFusion runs as

    has read access to the files ?

    --

    Mack


    Hi

    Ok, it seems that using rewriting together with the PT (pass-through) flag really helps. I've added the following lines to httpd.conf:

         # mod_rewrite stuff
         RewriteEngine on
         RewriteCond %{REQUEST_URI}      ^([^.]*)$
         RewriteRule (.*)                $1.cfm  [PT]

         [...]

         # mod_alias stuff
         Alias /Admin.cfm    /usr/local/httpd-2.2.16/htdocs/CFIDE/administrator/index.cfm

    Now the Login-Page for the ColdFusion Administrator pages show just fine.

    Of course, this solution means that all requests that don't have an extension, will be handled as if the request had a .cfm extension, which could be a problem...

    As a further step, it might be a good idea to use the RewriteMap directive, which would allow me to combine the .cfm and the aliasing in one place.

    If you have any hints, ideas, they're more than welcome.

    Kind Regards
    Daniel