[plug] Apache Rewrite Rule

Leon Wright techman83 at gmail.com
Tue Jan 1 13:23:50 WST 2013


Jason,

It was a small spurt of inspiration at the time. However I haven't finished
developing the web app and haven't revisited the how I'm going to deploy
it, as there is a few ways to skin the dancer cat.

I reckon you may have something though, the only time I did get it to work
caused it to recurse until apache returned a http 300 (I think that was the
error, was a little while ago).

I'll give it a whirl and let you know how I get on.

Leon

--
DRM 'manages access' in the same way that jail 'manages freedom.'

# cat /dev/mem | strings | grep -i cats
Damn, my RAM is full of cats... MEOW!!


On Tue, Jan 1, 2013 at 11:22 AM, Jason Nicholls <jason at mindsocket.com.au>wrote:

> Hey Leon,
>
> Did you get this sorted out?
>
> I don't think you need the QSA flag as you're not replacing the query
> string. Here's an alternative you can try with your cond commented out just
> in case.
>
> RewriteEngine On
> # RewriteCond %{REQUEST_FILENAME} !-f
> RewriteCond %{REQUEST_URI} !/water/dispatch.cgi/.*
> RewriteRule ^/water/(.*) /water/dispatch.cgi/$1 [L]
>
>
> The cond I introduced was to avoid re-writing any requests with
> dispatch.cgi in them.
>
>
> Jason
>
>
>
> On Mon, Dec 17, 2012 at 12:59 PM, Leon Wright <techman83 at gmail.com> wrote:
>
>> Hi Guys,
>>
>> Been playing with Perl's Dancer web framework, it's rather nifty! I have
>> hit a stumbling block with my Apache rewrite rule knowledge.
>>
>> There is something wrong with this as it doesn't appear to rewrite
>>
>> http://host/water/foo
>>
>> to
>>
>> http://host/water/dispatch.cgi/foo
>>
>> Alias /water /usr/local/leon/DanceApp/public
>>
>> <Directory "/usr/local/leon/DanceApp/public">
>>    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
>>    Order allow,deny
>>    Allow from all
>>    AllowOverride None
>>    AddHandler cgi-script .cgi
>> </Directory>
>>
>> RewriteEngine On
>> RewriteCond %{REQUEST_FILENAME} !-f
>> RewriteRule ^/water/(.*)$ dispatch.cgi/$1 [QSA,L]
>>
>> ErrorLog  /var/log/apache2/water-error.log
>> CustomLog /var/log/apache2/water-access_log common
>>
>> This works:
>> http://10.2.0.66/water/dispatch.cgi/foo
>>
>> But this doesn't:
>> http://10.2.0.66/water/foo
>>
>> Which if my rewrite rule was correct should.
>>
>> Any apache experts out there? The regex looks correct to me and I have
>> tried a few other variations.
>>
>> Leon
>> --
>> DRM 'manages access' in the same way that jail 'manages freedom.'
>>
>> # cat /dev/mem | strings | grep -i cats
>> Damn, my RAM is full of cats... MEOW!!
>>
>>
>> _______________________________________________
>> PLUG discussion list: plug at plug.org.au
>> http://lists.plug.org.au/mailman/listinfo/plug
>> Committee e-mail: committee at plug.org.au
>> PLUG Membership: http://www.plug.org.au/membership
>>
>
>
>
> --
> Jason Nicholls
> jason at mindsocket.com.au
> 0430 314 857
>
> _______________________________________________
> PLUG discussion list: plug at plug.org.au
> http://lists.plug.org.au/mailman/listinfo/plug
> Committee e-mail: committee at plug.org.au
> PLUG Membership: http://www.plug.org.au/membership
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.plug.org.au/pipermail/plug/attachments/20130101/082a7f09/attachment.html>


More information about the plug mailing list