Rewriting URLs from subdomain to domain in Apache
- by Nazgulled
Hi,
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...