Reverse Proxy

ISAPI_Rewrite is Apache mod_rewrite compatible URL rewriter for Microsoft IIS
User avatar
Posts: 3
Joined: 10 Jul 2013, 02:27

Reverse Proxy

10 Jul 2013, 02:40

I have a website located at hosting A, e.g. mysite.com. I created a blog located at Hosting B, which is a subdomain of hosting A, blog.mysite.com

I need to do a reverse proxy because I want the blog to be a subdirectory, mysite.com/blog

I've tried the following reverse proxy rule, but it doesn't seem to work. What did I do wrong? Any help would be appreciated. Thanks.

RewriteProxy ^/blog(/.*)?$ http://blog.mysite.com$1 [NC,U]

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: Reverse Proxy

10 Jul 2013, 20:29

Hello,

I assume you want to use the following in your hosting B config file:

Code: Select all
RewriteEngine on
RewriteBase /

RewriteCond ^blog\.mysite\.com$ [NC]
RewriteRule ^(.*)?$ http://www.mysite.com/blog/$1 [NC,P]


Usually people want to request blog.domain.com and have the content being loaded from site.com/blog. Did I understand your situation correctly?

Regards
Andrew

User avatar
Posts: 3
Joined: 10 Jul 2013, 02:27

Re: Reverse Proxy

10 Jul 2013, 20:55

Actually, it's the opposite. I want to request site.com/blog, but want the content to be loaded from blog.site.com. For SEO purposes, I want the link to be a subdirectory and not a subdomain, which is why I need to do a reverse proxy.

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: Reverse Proxy

10 Jul 2013, 22:43

That's quite unusual :)

Code: Select all
RewriteEngine on
RewriteBase /

RewriteCond ^www\.mysite\.com$ [NC]
RewriteRule ^blog/(.*)?$ http://blog.mysite.com/$1 [NC,P]


Regards
Andrew

User avatar
Posts: 3
Joined: 10 Jul 2013, 02:27

Re: Reverse Proxy

11 Jul 2013, 18:25

Hi Andrew,

It doesn't seem to work. My main ecommerce website is on mysite.com on host A, but my wordpress blog is hosted on host B as a subdomain (blog.mysite.com). I pointed blog.pimfg.com on my DNS to the IP of host B. Since mysite.com is hosted on my own server, that includes subdirectories on my server, I need a way to do a reverse proxy so that I can type mysite.com/blog (which doesn't exist), but get content from blog.pimfg.com. They are on 2 completely different servers, so I read that ISAPI rewrite has a reverse proxy function that allows me to type a site on my server, but get the content from another server without redirecting the URL. I got the information from this article moz.com/blog/what-is-a-reverse-proxy-and-how-can-it-help-my-seo and other forums suggest using ISAPI Rewrite for this.

- Regards, William

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: Reverse Proxy

11 Jul 2013, 18:40

That's exactly the code you wanted. What kind of result do you get?
We should probably take a look at the rewrite.log. Logging issues are described in http://www.helicontech.com/forum/10648-FAQ.html

Regards
Andrew

User avatar
Posts: 2
Joined: 20 Nov 2013, 05:42

Re: Reverse Proxy

20 Nov 2013, 05:50

mogwyz

Have you got a working script for it to work yet? I tried the following script but in rewrite.log it shows not-matched and it shows 403 forbidden


Code: Select all
RewriteEngine on
RewriteBase /

RewriteCond ^www\.mydomain\.com$ [NC]
RewriteRule ^blog/(.*)?$ http://blog.mydomain.com/$1 [NC,P]


Log

173.55.182.159 173.55.182.159 Wed, 20-Nov-2013 00:37:49 GMT [www.mydomain.com/sid#740773336][rid#21635008/initial] (1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
173.55.182.159 173.55.182.159 Wed, 20-Nov-2013 00:37:49 GMT [www.mydomain.com/sid#740773336][rid#21635008/initial] (1) Htaccess process request d:\mydomain\home\blog\.htaccess
173.55.182.159 173.55.182.159 Wed, 20-Nov-2013 00:37:49 GMT [www.mydomain.com/sid#740773336][rid#21635008/initial] (3) applying pattern '^(.*)?$' to uri 'blog/'
173.55.182.159 173.55.182.159 Wed, 20-Nov-2013 00:37:49 GMT [www.mydomain.com/sid#740773336][rid#21635008/initial] (4) RewriteCond: input='^www.mydomain.com$' pattern='[NC]' => not-matched

Return to ISAPI_Rewrite 3.0

Who is online

Users browsing this forum: No registered users and 7 guests