Redirecting a subdomain to a subdirectory

I’m wondering if the following is possible - and if it is, how it could be done -

Can I redirect:


You can do it using .htaccess rule… take a look at a sample rule you can set for your subdomain.

RewriteEngine On
RewriteCond %{HTTP_HOST} ^blog\.mysite\.com
RewriteRule ^(.*)$ /blog/$1 [L]

Thanks for that, is it possible for that to be used to redirect to a specific page within the site?

Yes 301 redirect will allow you to do that. Also if you do not know how call your web host and ask them to install that for you.
That will be 1 minute work for them.

Yes you can

RewriteRule ^old/URL/path$ new path [R=301,L]

new path- full path including your domain

Thanks, I can do that but I wanted to get my head around how it works as well.

In the case where the subdomain is/was hosted by host A and the main site (and page within it) is hosted by host B, would you still dump the htaccess file in the root of the main domain?