Solved

apache rewrite

Posted on 2011-09-15
4
334 Views
Last Modified: 2012-05-12
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.
0
Comment
Question by:lionel3030
  • 3
4 Comments
 
LVL 7

Expert Comment

by:jackiechen858
ID: 36545272
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/
0
 

Author Comment

by:lionel3030
ID: 36545750
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>
0
 

Accepted Solution

by:
lionel3030 earned 0 total points
ID: 36546565
solutions use proxypassmatch
0
 

Author Closing Comment

by:lionel3030
ID: 36565531
Was in a rush resolved this issue alone
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Linux Real Time Memory on Distinct 24 Cycle 7 42
Recover Lacie Edmini data. 11 63
$_SERVER Variable question 31 50
htaccess block all countries but the US 4 35
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question