301 Redirect from Sub-Directory to Root

301 Redirecting from Sub-Directory to RootIf 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 should help you do the trick :

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

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 .

Just a quick note to help someone who was struggling with that issue. Hope that helps.