On Thu, Mar 11, 2010 at 5:05 AM, icovnik <icovnik@gmail.com> wrote:
On Thu, Mar 11, 2010 at 9:29 AM, Alexis Sukrieh <sukria@sukria.net> wrote: [ cut ]
RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule /App1(.*)$ /App1/public/dispatch.cgi$1 [QSA,L] RewriteRule /App2(.*)$ /App2/public/dispatch.fcgi$1 [QSA,L] [cut] This works perfectly well on my box, it should work on yours ;)
Yes perfect! That's the thing I wanted. Thank you.
Just one more thing (probably more about Apache than about Dancer). Currently the URI
http://server/App1/public/dispatch.cgi/foo/bar
is catched by script /App1/public/dispatch.cgi. In dispatch.cgi it is matched by rule
get '/foo/:par' => sub { ... };
I just wonder whether is it possible to get rid of that "dispatch.cgi" part in URI? To make the same functionality but with URIs like this:
http://server/App1/public/foo/bar
e.g. to completely hide the script name from outside.
That is exactly what the RewriteRule is doing...
RewriteRule /App1(.*)$ /App1/public/dispatch.cgi$1 [QSA,L]
In english, it is saying, "if the path in the browser looks like a 'slash' followed by 'App1' possibly followed by other text (note, there is no 'dispatch.cgi' in the path in the browser', take all of the other text and stick it in '$1', then pretend the following path was requested - a 'slash' followed by 'App1/public/dispatch.cgi' followed by everything that was stuffed away in '$1'". So, I request '/App1/icovnik', and the server processes the command '/App1/public/dispatch.cgi/icovnik' which is taken by Dancer and broken into params->{:p} that you can now use in your query.
Thank you.
ico _______________________________________________ Dancer-users mailing list Dancer-users@perldancer.org http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
-- Puneet Kishor http://www.punkish.org Carbon Model http://carbonmodel.org Charter Member, Open Source Geospatial Foundation http://www.osgeo.org Science Commons Fellow, http://sciencecommons.org/about/whoweare/kishor Nelson Institute, UW-Madison http://www.nelson.wisc.edu ----------------------------------------------------------------------- Assertions are politics; backing up assertions with evidence is science =======================================================================