[dancer-users] Perl Dancer Rewrite url

John J. McDermott, CPLP jjm at jkintl.com
Thu Oct 22 17:02:55 BST 2015


I think I have this right. The doc says

    The RewriteRule directive is the real rewriting workhorse. The
    directive can occur more than once, with each instance defining a
    single rewrite rule. The order in which these rules are defined is
    important - this is the order in which they will be applied at run-time.


Your RewriteRule ^/website/(.*) / rule appears to get rid of everything
after the first "/" in the case of /website. The second rule has nothing
to operate on for /website. So
whate.ver/website/contact becomes
whate.ver/

Also note that context is important. Again from the docWhat is matched?

    In |VirtualHost
    <http://httpd.apache.org/docs/current/mod/core.html#virtualhost>|
    context, The /Pattern/ will initially be matched against the part of
    the URL after the hostname and port, and before the query string
    (e.g. "/app1/index.html").

    In |Directory
    <http://httpd.apache.org/docs/current/mod/core.html#directory>| and
    htaccess context, the /Pattern/ will initially be matched against
    the /filesystem/ path, after removing the prefix that led the server
    to the current |RewriteRule| (e.g. "app1/index.html" or "index.html"
    depending on where the directives are defined).

    If you wish to match against the hostname, port, or query string,
    use a |RewriteCond
    <http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritecond>|
    with the |%{HTTP_HOST}|, |%{SERVER_PORT}|, or |%{QUERY_STRING}|
    variables respectively.



--john

On 10/22/2015 9:49 AM, Hugues wrote:
> Hello
> I use perl dancer with Apache in mod_proxy + starman.pl
>
>
>  ProxyPass / http://localhost:5002/ retry=0 Keepalive=on
>  ProxyPassReverse / http://localhost:5002/
>
> I've got path like
> /website/about
> /website/contact
> etc..;
>
> for www.mydomain.com
> I would like to rewrite url
>
> /about
> /contat
> etc..
>
> I try with
>
> RewriteRule ^/website/(.*) /
> RewriteRule ^/(.*) http://localhost:5002/$1 [P]
>
>
> but result is no good, I go to /....
>
> if someone has a idea ?
> Thanks
>
> Hugues.
> _______________________________________________
> dancer-users mailing list
> dancer-users at dancer.pm
> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users

-- 
John J. McDermott, CPLP
Learning and Performance Consultant
jjm at jkintl.com 575/737-8556
Check out my security blog posts <http://cybersecurity.learningtree.com>
Add an A for the Arts To STEM and get STEAM and a strong engine to move
forward.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20151022/73574cbc/attachment.html>


More information about the dancer-users mailing list