Are you just trying to get the index.cfm out the URL? You cannot set the
module delimiter to "/" so this won't work well:
/index.cfm?event=$1/$2" [NC,QSA]
Leave it at the standard ":" for now or change it to a "." or "-"
(provided that none of your event handler names uses that delimiter.
The module delimiter must be unique.
The parseSESUrl means that Mach-II is going to look for data in the
cgi.path_info for you (basically it's a simplistic mod_rewrite without
the URL rewriting functions). If you are going to let your web server
do that, then set that parameter to false.
Any SES URLS that are being rewritten, you'll need to use the HTML <base
href=""> tag directive to tell the browser where to look for assets.
Doug said the following on 07/07/2009 01:44 PM:
> Except that none of the image/css/js files are loaded because the path
> to them is not being parsed correctly. For example, this url:
>
> http://local.www.daveramsey.com/dashboard/sys.serveAsset/path/%40js%40generic.js
>
This is because the dashboard uses an event-handler to serve all images
and css/js. Somewhere your rewrite rules aren't working.
> includes the "path" parameter needed by the dashboard's sys.serveAsset
> event, but parseSesParameters() is looking for that in the
> cgi.PATH_INFO. However, PATH_INFO is empty, as everything is being
> sent to the QUERY_STRING by my mod_rewrite rule.
>
I'd just consider letting Mach-II do everything if you are just trying
to remove the index.cfm by using a rule like this:
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
RewriteRule "^/(.*)?$" "/index.cfm/$1" [NC,QSA]
By just adding in the index.cfm file to the URL and letting Mach-II
parse the path_info data for you. You'll have to make sure you're not
rewriting URLs to CSS / JS / image / docs directory in your rules.
> I've tried many different permutations of different rewrite rules and
> Mach-II URL configs in an attempt to pass the whole URL in the
> PATH_INFO instead of the QUERY_STRING. No matter what I've tried I
> have been unable to make the URL example shown here work:
>
> http://greatbiztoolsllc.trac.cvsdude.com/mach-ii/wiki/URLManagementFeatures#HowToDoSearchEngineSafeFriendlyURLs
>
> The example there is: "/index.cfm/event/displayMusician/firstName/Bob/
> lastName/Dylan/".
>
> All attempts to pass a URL like that to ColdFusion (without a real ?
> to delimit the query string) completely fail.
>
If you are using Tomcat (and possibly other application servers), you
loose the cgi.path_info -- there are ways to get it in there, but I
don't know your server tier setup.
.Peter
Hi Peter, thank you for your response. Please see below: On Jul 9, 6:45 pm, "Peter J. Farrell" <pe...@mach-ii.com> wrote:Leave it at the standard ":" for now or change it to a "." or "-" (provided that none of your event handler names uses that delimiter. The module delimiter must be unique.Using a module delimiter of "/" is actually working well for us. BuildURL is writing the correct URLs, and our rewrite rules *do* correctly put the index.cfm back into the URL and pass the module and event to ColdFusion. That works fine.
What we're missing are any additional parameters that follow the module/event, like: /module/event/param1/val1/param2/val2
However, we may have a rewrite rule strategy that even passes those along correctly, but it unfortunately bypasses parseSesParameters().
On Jul 9, 6:45 pm, "Peter J. Farrell" <pe...@mach-ii.com> wrote:If you are using Tomcat (and possibly other application servers), you loose the cgi.path_info -- there are ways to get it in there, but I don't know your server tier setup.We are using Tomcat/JBoss. Is that why this fails? If you know of workarounds so that the cgi.PATH_INFO is passed correctly in Tomcat, that would be very helpful. I'll install JRun again locally and try it that way in the mean time.
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
RewriteRule "^/([A-Za-z0-9-_]+)/([A-Za-z0-9-_\.]+)/(.*)" "/index.cfm/$3?event=$1/$2" [NC,QSA]
This is because the path info stuff must be after the file name and the
query string parameters comes after that.RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
RewriteRule "^/([A-Za-z0-9-_]+):([A-Za-z0-9-_\.]+)/(.*)" "/index.cfm/$3?event=$1/$2" [NC,QSA]
Or with "-"RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
RewriteRule "^/([A-Za-z0-9-_]+)\-([A-Za-z0-9-_\.]+)/(.*)" "/index.cfm/$3?event=$1/$2" [NC,QSA]
Base app urls without a module would look like this:RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
RewriteRule "^/([A-Za-z0-9-_]+)/(.*)" "/index.cfm/$3?event=$1/$2" [NC,QSA]
Using a unique module delimiter will also let you pass on everything as
a SES param as well instead
of rewriting stuff into the query string (because some request will
like using PUT instead of POST for search forms).RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
RewriteRule "^/([A-Za-z0-9-_]+)\-([A-Za-z0-9-_\.]+)/(.*)" "/index.cfm/$1-$2/$3/?" [NC,QSA]
With query string:
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
RewriteRule "^/([A-Za-z0-9-_]+)\-([A-Za-z0-9-_\.]+)/(.*)\?(.*)" "/index.cfm/$1-$2/$3/?$4" [NC,QSA]
FYI, I haven't tested this rewrite strings directly -- just typing from
memory -- so you'll have to check them.Thanks Aaron! I missed this when you first posted it.
If you get a chance and don't mind sharing, can you copy/paste the
Mach-II-specific information up on the wiki? Or if you don't have time,
and with your permission and credit to you along with a link to your
blog post, I can post it up there.
It's great info and I'd love to have it in the wiki when people search
on this topic.
--
Matthew Woodward
ma...@mattwoodward.com
http://www.mattwoodward.com/blog
Please do not send me proprietary file formats such as Word, PowerPoint,
etc. as attachments.
http://www.gnu.org/philosophy/no-word-attachments.html