• WEBSITECM IS NOW
    Smack Digital Inc.

How To Move X-Cart To Root Directory

Posted by and last updated Apr 19, 2014 12:50 PM

By default, X-Cart installs to an xcart folder which isn't great for your SEO. This tutorial will assist you in safely moving your store to root.


By default X-Cart installs to an xcart folder which is great advertising for X-Cart, but is not so great for your security or your SEO. This tutorial will assist you in moving your store out of the xcart folder. The same process will work if you've installed to a "store," "shop," or other subfolder, simply substitute your subfolder name for "xcart" below.
  1. Check with your web host to ensure that ModRewrite is supported and only proceed if so.

  2. Be sure that no files in your root directory have names similar to those in your X-Cart directory, otherwise there will be a conflict and the files will not be able to be moved.

  3. Using an FTP program, or File Manager program such as that available in cPanel, Plesk, and/or other web hosting control program, move all of your files from the xcart folder to the root. Be sure that your .htaccess files are also transferred as sometimes these files are hidden by FTP programs.

  4. Using a file editor, open your config.php and find:

    $xcart_web_dir = '/xcart';

    Change to:

    $xcart_web_dir = '';

  5. Upload your modified config.php

  6. Now, the most important part of this tutorial. At this point, all of your old links and file references will be broken. To preserve your old links and search engine positions, you will want to redirect your old links to your new links, which can be achieved using the following code in an .htaccess file (be sure to substitute example.com with your domain name).

    # WCM - Site moved from subfolder to root
    RewriteEngine On
    RewriteRule ^xcart/(.*)$ http://www.example.com/$1 [R=301,L]
    # WCM - Site moved from subfolder to root

  7. Clear your template cache by visiting http://www.example.com/cleanup.php

  8. Manually change any hard-coded links throughout your site. While the code from step 6 will ensure that links are broken, you don't want to have to rely on 301 redirects long-term.

About the Author

Jonathan Peters Jonathan's founder of Smack Digital, a digital strategy agency that creates and executes online business success for executives who are highly motivated to quickly increase their market share. With more than two decades of experience on the web for clients ranging from non-profits to billion dollar enterprises, Jonathan's an expert in web development, eCommerce, software programming, search engine optimization and social media marketing.

Browse By Category

RSS Feeds

Don't miss out! Subscribe to our RSS Feeds to receive instant notification when new entries are added.

RSS Feed for All Categories
RSS Feed for X-Cart How-Tos
We choose our clients selectively.
Let's talk success. Apply to work with us.
Apply toWork With Us
Apply toWork With Us