I love this topic! I got caught up in Apache rewrite and Mach-ii stuff when modules version came out in version 1.5of Mach-ii. I wrote a blog post that explains how to create "go" URLs that filter through Apache's mod_rewrite and pass the appropriate URL structure for Mach-ii modules. Check it out if you are interested.
http://tinyurl.com/2mfpkv -- | Aaron West | http://www.trajiklyhip.com/blog | Certified Advanced Adobe ColdFusion MX 7 Developer | Certified Macromedia Flash MX Developer | Adobe Community Expert On Fri, Jul 10, 2009 at 10:56 AM, Peter J. Farrell <[email protected]>wrote: > Just wanted to say your rewrite rule from what I explained before should > look like this: > > 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. > > I'm not convinced that the module delimiter of "/" will work all the time > because in the base application, the module doesn't exist in the URL. With > a module: > > /index.cfm/moduleName/eventName/param1/value1/ > > Whereas in the base application, it looks like this: > > /index.cfm/eventName/param1/value1/ > > You're rewrite rules will match stuff up strangely in this case because the > regex will think the module name is the value in the position of "eventName" > and the event name will be in the position of "param1". This is why you'll > probably have an easier time with the regex if your module delimiter is > unique (using a ":" or you can use a "_" or "-" if they are not being used > in event-handler names). > > When a module exists using a module delimiter of ":": > > 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). > > This rule will pass query string data as well if available. No 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/?" [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. > > .Peter > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to Mach-II for CFML list. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/mach-ii-for-coldfusion?hl=en SVN: http://greatbiztoolsllc.svn.cvsdude.com/mach-ii/ Wiki / Documentation / Tickets: http://greatbiztoolsllc.trac.cvsdude.com/mach-ii/ -~----------~----~----~----~------~----~------~--~---
