[plug] Apache Rewrite Rule

Jason Nicholls jason at mindsocket.com.au
Tue Jan 1 11:22:39 WST 2013


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.plug.org.au/pipermail/plug/attachments/20130101/d411b99e/attachment.html>


More information about the plug mailing list