title: Redirecting user to new domain when he hit the old domain
body: <p>I have made a sub-domain and moved my website from root to sub-domain now I want all the users to be redirected when they hit the old domain I have write some rules in my .htaccess file but those rules are not working here these are the rules I have been writing in my .htaccess file.</p>
  
  <pre><code>RewriteEngine On
  RewriteCond %{HTTP_HOST} !http://hkdcrandom.com$ [NC]
  RewriteRule ^(.*)$ https://www.hkdcrandom.com/blog/$1 [L,R=301]
  </code></pre>
  
  <p>Can anyone please help me find out what is it that I am doing wrong here would be a great help for me and saves my time as well.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I have checked it again my rule is working but with a strange behaviour and that is when I hit the domain.</p>
  
  <blockquote>
    <p><a href="http://hkdcrandom.com" rel="nofollow noreferrer">http://hkdcrandom.com</a></p>
  </blockquote>
  
  <p>It do nothing but when I hit with <strong>www</strong> like this</p>
  
  <blockquote>
    <p><a href="http://www.hkdcrandom.com" rel="nofollow noreferrer">http://www.hkdcrandom.com</a></p>
  </blockquote>
  
  <p>it works fine and redirecting me back the exact URL that I want. Don't know why it is doing so as I have not given any <strong>www</strong> while writing my rule.</p>