Need to change the location of your store?

In this board, we will periodically list various tips and tricks we find that may help in your use of PrestaShop. This will also include tips on the use of Agile modules. If you have a great tip, fix, or workaround for a PrestaShop feature, feel free to post it here...

Need to change the location of your store?

Postby Terry » Mon Mar 11, 2013 8:30 pm

There are times when it becomes necessary to move your store to a new location for one reason or another. It could be because of a change to your website structure, or any number of other reasons. Whatever the reason, let's say you need to move your store to a new folder.

Because the URL of the store changes, this can have a ripple effect through your entire store, causing many or your existing page links to throw a 404 error (page not found). Of course you can and should manually change all menu links, etc., but there will almost always be at least some links that are initially missed.

As you would think, this can have a devastating effect on your business because customers won't find your products and will be put off by the page errors. So, what can you do to quickly remedy the situation? You can use a 301 redirect.

Note that this tip is for those on Apache based servers.

There are many ways to redirect a web address, this is only one of them. It is, however, very easy to do. Simply create an 'htaccess' file in the original location.

In the htaccess file, use the "Redirect 301" directive as follows:

If it is from one sub-folder to new sub-folder, the following line will work:
Redirect 301 /oldfolder/ /newfolder/

If it is from one domain to another, the following line will work:
Redirect 301 /olddomain/ /newdomain/

If it is from the root folder to a sub-folder, or sub-folder to root in the same domain, the following examples would work:
Redirect 301 /en/ /store/en/
Redirect 301 /fr/ /store/fr/
..
Redirect 301 /content /store/content
Redirect 301 /content/category /store/content/category
Redirect 301 /modules/ /store/modules/

Also, make sure you have put the line "RewriteEngine on" at the beginning of the htaccess file.

This tip may not work correctly on all servers, or additional directives may be necessary such as "RedirectMatch". See the following article for more information.

http://www.internetmarketingninjas.com/ ... -redirects
Terry
 
Posts: 125
Joined: Mon Oct 22, 2012 12:49 am

Return to Tips and Tricks for PrestaShop and Agile Modules

Who is online

Users browsing this forum: No registered users and 4 guests