How to redirect domain to subdirectory without redirecting url

If the url shows only domain name and if you want to redirect your domain name to sub-directory

For example :

http://yourdomain.com redirect to http://yourdomain.com/blog but the URL shows only http://yourdomain.com

Then add the following rules in your .htaccess file.

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^yourdomain.com
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=301,L]
RewriteRule    ^$   blog/    [L]
RewriteRule    (.*)  blog/$1 [L]
</IfModule>

It is easy but to perform this task you need to consider one of the Ownwebservers web hosting plans and then edit or upload a .htaccess file from your file manager or SSH access on your cPanel hosting plan or a Linux Dedicated Server or the linux VPS hosting plan.