-   Linux - Server (
-   -   Apache URL rewriting (

linuxlover.chaitanya 04-09-2013 02:07 AM

Apache URL rewriting
Hello all,

We have a requirement where we need forward a internal URL to external HTTPS link. This HTTPS link is our exchange outlook web access. I have tried ReverseProxy and URL rewrite and redirect. Though the redirection is working in these cases, the URL on the client end browser changes to the original which is not what I want.

This is what I tried:


ProxyPass /app1/ https://<our-link>/owa/
ProxyPassReverse /app1/ https://<our-link>/owa/

<Location ~ "^/(app1/)">

This actually redirects the /app1/ but the original URL is visible on the client browser.



RewriteEngine on
RewriteRule ^/app1/(.+) https://<our-link>/owa/$1 [R,L]

This does not work at all. But I find this method promising as the error I get is /app1/ not found on the server.

Is there any way of doing what I want to?

vishesh 04-10-2013 11:57 AM

Can you try with

RewriteRule ^/app1/([A-Z_a-z\.?&=]*)$ https://<our-link>/owa/$1 [R=301]

As it seems that GET or POST data not getting passed correctly.


linuxlover.chaitanya 04-13-2013 06:22 AM

Does not seem to be working the way I want it to. The client URL still changes to the redirected one.

linuxlover.chaitanya 04-14-2013 12:27 AM

I seem to have got ahead with something but not working exactly I would like it to be.
Following is the configuration that has got me some further not to the destination though.


        SSLEngine On
        SSLProxyEngine On
        SSLCertificateFile /etc/pki/tls/certs/localhost.crt
        SSLCertificateKeyFile /etc/pki/tls/private/localhost.key

        ProxyPass /app1/ https://<our-link>/owa/
        ProxyPassReverse /app1/ https://<our-link>/owa/

        <Location ~ "^/(app1/)">

        ProxyPass /app2/
        ProxyPassReverse /app2/

        <Location ~ "^/(app2/)">

The /app2/ works for me but /app1/ does not. I get only a blank page.

Following is the error I see in the logs for /app1/


File does not exist: /var/www/html/owa, referer:<our-link>/owa/&reason=0
I dont understand why it is referring to the local file when it is configured to only refer the exchange web access link.

Any help would be much appreciated.

linuxlover.chaitanya 05-07-2013 03:42 AM

Resolved the issue by just changing the Virtual Directory to /owa/. Strange but true.

All times are GMT -5. The time now is 06:40 PM.