[dancer-users] Perl Dancer Rewrite url
Hugues
hugues at max4mail.com
Thu Oct 22 17:28:29 BST 2015
Hello
the goal is to remove website in this url
http://whatever.com/website/about
but without to change my Dancer code and my routes
my appli has 2 parts , a authenticate par with /about
a public part with /website/about but different than /about -
/website/ is not very nice see and I looking for a solution to remove
it only in url
Hugues.
Le 22/10/2015 18:19, John J. McDermott, CPLP a écrit :
> I am confused. I thought the goal was to rewrite
> whatever.com/website/about
> to
> http://localhost:5002/about
>
> If someone goes to
> http://whatever.com/websiet/about
> where do you want the redirection to go?
>
> --john
>
> On 10/22/2015 10:11 AM, Hugues wrote:
>> Hello
>>
>> see my rewrite log
>>
>> init rewrite engine with requested uri /website/about
>> applying pattern '^/website/(.*)' to uri '/website/about'
>> rewrite '/website/about' -> '/'
>> applying pattern '^/(.*)' to uri '/'
>> rewrite '/about' -> 'http://localhost:5002/about'
>> forcing proxy-throughput with http://localhost:5002/about
>> go-ahead with proxy request proxy:http://localhost:5002/about [OK]
>>
>> but /about route do not existe, this is /website/about and I've got a
>> 404...
>>
>> It seems like Rewrite Rules is not a possible ( or if I create fake
>> routes /about....)
>>
>>
>> Le 22/10/2015 18:02, John J. McDermott, CPLP a écrit :
>>> 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.
>>>
>>>
>>> _______________________________________________
>>> dancer-users mailing list
>>> dancer-users at dancer.pm
>>> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
>>
>>
>>
>> _______________________________________________
>> 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.
>
>
> _______________________________________________
> dancer-users mailing list
> dancer-users at dancer.pm
> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20151022/ecc49980/attachment.html>
More information about the dancer-users
mailing list