Click here to Skip to main content
15,919,358 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
Hi there I have a situation where I'm getting confused as to how my goal can be achieved. This is a simple case.

All I need to do is redirect www.example.com/blog to blog.example.com but in such a way that the URL is rewritten so it's showing the content of blog.example.com under the link www.example.com/blog

www.example.com/blog lives on a Windows 2003/IIS.6 server hosted by us.
blog.example.com lives on WordPress hosted by DreamHost.

I understand that I have to place my rewrite on the Windows server where www.example.com lives and redirect accordingly.

So what I imagine that will happen is that when I go to www.example.com/blog I will see the content of blog.example.com (is that correct?)

If so then this is what I wanted but.

Because the reason for all this is SEO I would need the blog.example.com to redirect (301) to www.example.com/blog/ in order to avoid duplicate content - as explained in this article http://www.seomoz.org/blog/url-rewrites-and-301-redirects-how-does-it-all-work[^]

In effect this is a full loop, so how will it work correct me if I'm wrong but the www.example/blog will just loop back to itself via the rewrite. How can this work?

I don't think it can work - what do you think? The article above seems solid though.

Any attempt to explain/correct will be much appreciated.

Pav
Posted
Updated 19-Aug-10 1:16am
v4

A rewrite means that you do, completely on the server side of one server, tell your web server to interpret an URL that is requested from a browser as another URL. The client has no knowledge of the internal rewrite.

What you want is a redirect. As you stated, this should be a 301 (permanent) redirect, not a temporary (302) redirect. This ensures that the "link juice" is transfered to the other URL.

I do this for my own blog, too. www.magerquark.de/blog [^] redirects to blog.magerquark.de [^] (both in German, you hardly will understand a word ;-)).

For IIS 6, I recommend URL rewriter [^], which is free of charge.

For IIS 7 and 7.5, please use the rewrite module (IIRC, it comes as an additional module to install).
 
Share this answer
 
Hi there Uwe,

Thanks for your reply but no this is not what I need. What I want is:

"redirect www.example.com/blog to blog.example.com but in such a way that the URL is rewritten so it's showing the content of blog.example.com under the link www.example.com/blog"

This is not a problem this is just a straight rewrite.

What I don't understand is the bit when you then redirect blog.example.com to www.example.com/blog as described in the second part of my posting.

In effect I want to give the "link juice" to www.example.com/blog

Cheers,

Pav
 
Share this answer
 
What you want is called a reverse proxy. Basically the IIS web server at www.example.com will get the request, translate it to a URL on another machine (in this case, blog.example.com), make the page request on behalf of the original caller and serve the result as though it had come from www.example.com

Helicon Ape does exactly this for a reasonable price.

Beware though, the HTML is returned to the client untreated, meaning that it may contain image, script, anchor and other URLs that are not relative (to www.example.com) and may end up directing the user to blog.example.com anyway. To address this you will need to rewrite the HTML once the reverse proxy has finished with it. You can add a module to Ape for that, or use Javascript, but you're getting into tricky territory.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900