Forum OpenACS Q&A: aolserver4 and url rewrite

Collapse
Posted by Dave Denney on
I've been searching for some module to give aolserver_v4_r0_beta_6 some form of url rewrite, similar to mod rewrite in Apache.  Is there any package of this type currently out there for aolserver4 or any other versions?

Sorry if this isn't the place to post this, but this seemed to be the closest place with a forum.

Thanks,
Dave

Collapse
Posted by Bjorn Thor Jonsson on
Collapse
Posted by Dave Denney on
This is kind of what I am trying to do right now.  The objective is to clean up url's so that file extensions aren't important to the user, and incidentally, so that the files can be any format we please.  Basically, I'm shooting to have all the links in "http://mydomain.com/filename" format, and have it then bounce them to "http://mydomain.com/filename.ext" where .ext is the extension of whatever I happen to be using at the time.  Would this work?  Would I run into problems with people providing "http://mydomain.com/directory/" with this?

Sorry about all these questions, but I'm totally new to AOLServer and TCL, and would like to have more information.  From what I've seen/done thus far, Aolserver is extremely powerful, and does just about everything I could ever ask of it.

As a final question, when the script below is gutted and fixed, where would I put it such that it would be executed every time a page is requested?

What I have thus far, pretty bad I know, and I guarantee that there are issues with it:

proc check_for_no_ext {}
{
        set requested_url [ns_conn url]
        if{!regexp [:alnum:]*\.[:alnum:]* requested_url match}
        {

                append new_url $requested_url ".tcl"
                append return_url "http://mydomain.com" $new_url
                ns_returnredirect $new_url
        }

        else
        {
                append return_url "http://mydomain.com" $requested_url
                ns_returnredirect $return_url
        }
}

ns_register_proc GET /* check_for_no_ext

Collapse
Posted by Andrew Piskorski on
Dave, are you using OpenACS? If so, are you sure the request processor with its abstract URLs doesn't already do what you need? If you notice, the URL for this very page on openacs.org is "message-view", not "message-view.tcl", which is what the actual file is named...

Also, what about the AOLserver nsrewrite module?

Collapse
Posted by Dave Denney on
I am not using OpenACS, this was a decision to try to keep the complexity down.  Nothing I am doing is big enough to require a Content Management System, so I tried not to borrow trouble, though this may have been the wrong decision.

I have been looking for nsrewrite, but have been unable to find it at all in the v4 source, or install.  I am presently assuming that it does not ship with v4 beta.  Also, nowhere have I found a link to download it alone.  Those that I think might help point to the now-defunct ArsD site.

This begs the question, should I be using Aolserver v4 at all?  Or should I fall back to the pretty ubiquitous 3.3?  Or will the packages pulled out of the 3.3 distribution work with 4?

Tomorrow I'm going to try using the 3.3 versions with 4 and seeing what happens.  There shouldn't be any major glitches, but I will keep the forums posted.  Thanks for all the help so far, I've learned a lot.

Collapse
Posted by John Sequeira on
Dave,

Do you have the option of using a mod_proxy/mod_rewrite Apache instance in front of AOLServer?

If those are tools you're familiar/comfortable with,  that might be the path of least resistance.

Collapse
Posted by Jamie Rasmussen on
nsrewrite came from Arsdigita and is in the OpenACS-customized tarball of AOLserver 3.3.  A version with some new documentation is in the AOLserver CVS repository on SourceForge, but hasn't been made available through the SF file downloads yet.

A current list of AOLserver modules is available here: http://empoweringminds.mle.ie/openacs/aolserver_modules

You might also be interested in what's new in AOLserver 4: http://empoweringminds.mle.ie/openacs/aolserver4_changes.txt

OpenACS is indeed complex, but the powerful request processor is just one of its features - even if you don't use any of the drop-in applications like the blog, forums, or photo album, you might like its user management, database procs, enhanced templating, schema and API browser, testing and debugging tools, ...

Please let us know how you fare with whatever you decide!