title: 301 Redirect Subdomain to subdirectory on an addon domain
body: <p><strong>My site setup is something like this</strong></p>
  
  <pre><code>**Main Domain** - domain.com
  
  **Addon domain** - addon.com
  
  **blog sub domain** - blog.addon.com
  
  **blog sub page** - blog.addon.com/post/54546/url-slug-here
  </code></pre>
  
  <p>Now <code>addon.com</code> is an add-on domain on a hostgator shared account where the root domain is <code>domain.com</code></p>
  
  <p>I want to make the <code>blog.addon.com</code> 301 redirect over to <code>addon.com/directory/blog</code></p>
  
  <p>For which I have tried </p>
  
  <pre><code>RewriteEngine on
  RewriteCond %{HTTP_HOST} ^blog.addon.com$ [NC]
  RewriteRule ^/?$ "http://addon\.com/directory/blog/" [R=301,L]  
  </code></pre>
  
  <p>Unfortunately the above code does not work at all. </p>
  
  <p>I also tried,</p>
  
  <pre><code>RewriteCond %{HTTP_HOST} ^blog\.addon\.com$
  RewriteRule ^(.*)$ http://www.addon.com/directory/blog/$1 [L,R=301]  
  </code></pre>
  
  <p>Both the codes above don't work. When I visit blog.addon.com - it simply shows me the default index.html I have up there.</p>
  
  <hr>
  
  <p><strong>Coming to Part 2 of my question</strong>,  </p>
  
  <p>I also need to redirect <code>blog.addon.com/post/54546/url-slug-here</code> over to <code>addon.com/pagename</code> and I have absolutely no clue how to achieve this.</p>
  
  <p>I have looked up many queries and tried a bunch, but like the earlier I simply get a 404 and nothing beyond that. </p>
  
  <p>I just want that particular URL redirected, not the whole set or wild cards. </p>
  
  <hr>
  
  <p>I am thinking this has something to do with the domain being an addon over the main domain. But the wordpress permalinks code and my other local 301 redirects like <code>domain.com/somepage</code> to <code>domain.com/someotherpage</code> work perfectly.</p>
  
  <p>Any help would be appreciated.</p>