My webserver is running Plesk and part of my site structure goes like this:

/
/httpdocs (domain root folder, URL: http://www.domain.com)
/subdomains
/subdomains/blog/httpdocs (blog root folder, URL: http://blog.domain.com)

I have a WordPress installation in the domain root folder and WP is configured to display a static page when accessing www.domain.com and to display the blog when accessing www.domain.com/blog.

However, I want to redirect (using mod_rewrite) all requests from http://blog.domain.com/ to http://www.domain.com/blog/.

A few examples:

Accessing http://blog.domain.com/archives should access http://www.domain.com/blog/archives/ Accessing http://blog.domain.com/tag/abc should access http://www.domain.com/blog/tag/abc/
Accessing http://blog.domain.com/some-post-title should access http://www.domain.com/blog/some-post-title

All this should be transparent to the user, the address shouldn't be changed on the browser's address bar. In better words, I want a URL rewrite and not a URL redirect.

Is this achievable with mod_rewrite? Can anyone help me with the .htaccess? All my attempts on doing so have failed...

link|improve this question

feedback

1 Answer

up vote 0 down vote accepted

You can of course proxy the requests from blog.example.com to example.com/blog. You can find simple examples for a reverse proxy in the documentation for mod_proxy. Just place the directives in an .htaccess file in the document root of blog.example.com or put them into the respective vhost.conf file.

But I really don't see any advantage over just redirecting the clients which you can achieve by simply placing an .htaccess file into the document root of blog.example.com with the content:

RedirectPermanent / http://www.example.com/blog/
link|improve this answer
Because, like I said, I don't want a URL redirect, I want a URL rewrite. – Ricardo Amaral Mar 25 '10 at 10:56
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.