If you’re hosting your website on a subdirectory and would like to move the site up to the root directory, like moving from www.yoursite.com/subdirectory to www.yoursite.com then this simple line of code in your root .htaccess file. This means that all files like www.yoursite.com/subdirectory/yourfile.htm would now be redirected to their equivalent location on root like www.yoursite.com/yourfile.htm .


Code:
RewriteEngine On
RewriteBase /
RewriteRule ^subdirectory/(.*)$ /$1 [R=301,NC,L]