Link to home
Start Free TrialLog in
Avatar of lionel3030
lionel3030Flag for United States of America

asked on

apache rewrite

Hi,
I want to do a rewrite to a /blog on a remote URL, i have a IIS server and in front of it a apache/proxy but my rules do not work here is the conf:
<VirtualHost *:80>
        ServerName www.mysite.com
        RewriteEngine on                                                                                                                                              
        ProxyPass ^/blog/(.*)$  http://ec2-xx-xx-xx-xx.compute-1.amazonaws.com/$1                                                                                    
        RewriteRule ^/blog$     /blog/
</VirtualHost>
Thanks.
Avatar of jackiechen858
jackiechen858
Flag of Canada image

I think you need ProxyPass, not Rewrite.


Try

ProxyPass /blog/  http://ec2-xx-xx-xx-xx.compute-1.amazonaws.com/
ProxyPassReverse  /blog/  http://ec2-xx-xx-xx-xx.compute-1.amazonaws.com/
Avatar of lionel3030

ASKER

Hi jackie and thanks for the reply.
What i am trying to do is to redirect all but a /blog and to redirect /blog to wp2.mysite.com
so right now i have
<VirtualHost *:80>
        ServerName www.mysite.com
        Options +FollowSymLinks
        RewriteEngine On
        RewriteCond %{HTTP}   ^www.mysite.com/blog$  [nc]
        ProxyPass ^/(.*)$          http://wp2.mysite.com/$1
 <Proxy balancer://mysite-cluster>
                Order allow,deny
                Allow from all
                BalancerMember http://wb1.mysite.aws route=wb1
                BalancerMember http://wb2.mysite.aws route=wb2
        </Proxy>


        ProxyPass /balancer-manager !
        ProxyPassMatch ^/(.+)$ balancer://mysite-cluster/$1 lbmethod=byrequests stickysession=BALANCEID
        ProxyPass / balancer://mysite-cluster/ lbmethod=byrequests stickysession=BALANCEID
        ProxyPassReverse / balancer://mysite-cluster/
</VirtualHost>
ASKER CERTIFIED SOLUTION
Avatar of lionel3030
lionel3030
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Was in a rush resolved this issue alone