SEO Friendly Rewrite Method to Move Website URL From Subdirectory to Root Parent Folder
You have set up your site, blog such as WordPress, Drupal, LiveJournal, or content management system such as Joomba and Mambo nicely at URL link such as http://www.domain.com/mylovelysite, and get decent traffic to the web site. Now in the reorganization exercise, you decide to move the site from sub-directory to the parent folder, properly at site’s root location instead. Moving the site to another folder or root folder will break all links and backlinks referenced to your website. If these broken links are not handled and redirected properly, there will be a lot of 404 page not found error, potentially drive away visitors, or in worst case, affect and lower the search engine ranking position (SERP).
The best way to manage the change of site’s URL due to movement of directory location is by using redirection feature provided by mod_rewrite module in Apache HTTPD web server. Most web hosts using Apache web server supports mod_rewrite redirect by default, and can implement this trick with ease. Else you will need to enable and turn on mod_rewrite module.
To redirect from a subdirectory or sub-folder to root directory, add the following line of text towards the top of .htaccess file located in the sub-directory to redirect all requests into that folder will be redirected to new location (i.e. root) properly. If the .htaccess file does not exist, create one.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^mylovelysite/(.*)$ /$1 [R=301,NC,L]
</IfModule>
Replace mylovelysite in the forth line above with the directory name on your website’s URL. These line in .htaccess will redirect requests for the /mylovelysite sub-directory to the root directory by stripping “mylovelysite/” out of the URL. For example, a visit to http://www.domain.com/mylovelysite/index.html will get redirected to http://www.domain.com/index.html, instead of returning an 404 error. This is useful for visitors who come to your site via bookmark or favorite, or those find your web pages via search engines that haven’t re-crawled, re-spidered and refreshed with the new URLs in their search indexes in the initial days after moving.
However, the movement will still likely to affect your site’s search engine rankings. The rewrite rules above make sure of 301 permanent redirect to ensure that the PageRank or ranking will pass over to the new URLs for search engine optimization (SEO). Until the new site structures get fully reindexed, the organic traffic from search engines may be reduced temporarily.
Share and contribute or get technical support and help at My Digital Life Forums.
Related Articles
- Add Trailing Slash to the End of the URL with .htaccess Rewrite Rules
- Redirect or Rewrite to Remove Double or Multiple Slashes (//) in URL
- Headdress for Mac OS X Reviews
- Search Engine Spider Simulator SEO Tool
- How to Change Folder Thumbnail Preview Picture in Windows Vista Explorer
- Change My Documents Folder Default Location Path in XP and Vista
- Create Custom Webclips Easily for iPhone
- How to Move WordPress Blog to New Domain or Location
- How to Bookmark A Web Page Into Firefox 3 Bookmarks Folder When Clicking on Star on Location Bar
- Edit Internet Explorer Typed URLs in Address Bar Dropdown List

































May 8th, 2008 14:40
Yeah.. I’m thinking to move my blog from /blogs/ to the main root…ugh.. I’m just too scared to do it
June 19th, 2008 19:17
Thanks dude i tried and it worked fine for my site http://www.hurricanesoftwares.com but unfortunately it didn’t worked out for my other site. Wondering whats wrong.
Ash