Support and Docs

3 Topics
Last post 11 November 2014 By Nadja Kristiansen
1 Topics
Last post 20 March 2014 By Carsten E. Madsen
0 Topics
Last post N/A By N/A
0 Topics
Last post N/A By N/A
1 Topics
Last post 02 April 2014 By Carsten E. Madsen

301 Redirects manager

  • 31/03/2015

The 301 redirects manager in eSeller Cloud enables you to easily create and maintain 301 redirects in your webshop – even if your webshop has several thousands of 301 redirect. By using regular expressions to define 301 redirects, you are able to save time and preserve overview by making rules which will apply for variants of the same URL.

Note that you can only specify redirects within your domain (and not to/from other domains).

Use the nifty testing tool to visualize what redirect matches a URL – or what URLs are not matched by any existing redirects.

This article describes the features of the 301 Redirects manager in the shop administration as well as how to use it.

301 Redirects manager

In the shop administration, redirects are managed at Base setup > General information > 301 redirects. Here you are able to browse through all specified redirects in the shop. You are able to search for a specific redirect (both “to” and “from” URLs are matched), and you can delete or edit existing redirects.

Creating a simple redirect

A simple redirect is characterized as leading from one static URL to another – for instance if we wish to redirect http://www.myshop.com/newsletter.aspx (“from URL”) to http://www.myshop.com/info/newsletter.aspx (“to URL”). In this example the “from URL” is where you would like to redirect from and the “to URL” is to where you would like the redirect to go.

In order to create a new simple redirect, click the “NEW 301 REDIRECT” button. Make sure that the “SIMPLE REDIRECT” option is selected – by selecting this option, you define that the redirect does not contain regular expression.

Specify the “TO URL” and “FROM URL” (Where should the shop redirect from? Where should the shop redirect to?)

When creating a simple redirect it is moreover possible to set whether or not query parameters should be passed in the redirect. This is specified by the “Pass any query parameters” option. If the option is checked any query parameters are matched and passed (kept) in the redirect. If the setting is disabled all non-specified query parameters will cause the redirect not to match.

For example: if “Pass any query parameters” is checked, then http://www.myshop.com/newsletter.aspx?customerID=1234&languageID=ENG will redirect to http://www.myshop.com/info/newsletter.aspx?customerID=1234&languageID=ENG.

- However if “Pass any query parameters” is unchecked, then http://www.myshop.com/newsletter.aspx?customerID=1234&languageID=ENG will not be a match for the redirect.

The Priority field is for setting a priority relative to other redirects (a number). If a URL matches more than one redirect, the redirect with the lowest priority number will be used - the lower the priority number, the higher the redirect will be prioritized.

When you’ve filled out the fields, click “Add redirect”. The redirect is now added to the list of 301 redirects, and when customers access the “From URL”, they are redirected to the “To URL”.

Creating a regular expression redirect

301 redirects can be defined by regular expressions. Regular expressions are a way of formulating formalized rules of pattern matching. Thereby you can specify a single regular expression, which can be used to redirect variants of the same URL. You are even able to use groups to make powerful rules that redirect thousands of URLs in one single line. Get help constructing valid regular expressions at http://regex101.com.

As for simple redirects it is possible to specify whether the regular expression redirect should pass query parameters. Note however that for regular expression redirects the shop does not actually know which part of the URL is the query parameters, and hence enabling this just means that anything after the matched segment will be passed on in the redirect.

You create a regular expression redirect by clicking the “NEW 301 REDIRECT” button. Make sure that the option “REGULAR EXPRESSION” is selected in the overlay that appears.

Below are a few examples that highlight some possible use cases of using regular expression for 301 redirects.

Regular expression - Example 1

In this first example we would like to redirect several variants of the same URL to another URL – The following four “From URLs” should redirect to the “To URL”.

From URLs:
/pi/Bosch-36V-4-5Ah-Lithium-batteri_4902_4181.aspx
/pi/Bosch-36V-4-5Ah-Lithium-batteri_4902_.aspx
/pi/Bosch-36V-4-5Ah-Lithium-batteri_4902_4236.aspx
/pi/Bosch-36V-4-5Ah-Lithium-batteri_4902_4234.aspx

To URL:
/pi/Bosch-36V-4-5Ah-Lithium-batteri-_431901_21566.aspx

This can be accomplished by specifying the “From URL” as a regular expression:
\/pi\/Bosch-36V-4-5Ah-Lithium-batteri_4902_[0-9]*\.aspx

This regular expression matches all URLs with the structure:
“/pi/Bosch-36V-4-5Ah-Lithium-batteri_4902_[any number or nothing].aspx”, and hence will match all of the variants of the URL’s specified above.

Now, the “To URL” should just be specified as:
/pi/Bosch-36V-4-5Ah-Lithium-batteri-_431901_21566.aspx

Verify that the regular expression is matching the URLs by entering each of them as the “Test URL” – by doing so you can test and verify that the regular expression is behaving as wanted. In this example we can see that the URL /pi/Bosch-36V-4-5Ah-Lithium-batteri_4902_4236.aspx (the Test URL) is redirected to /pi/Bosch-36V-4-5Ah-Lithium-batteri-_431901_21566.aspx.

If the Test URL does not match the regular expression, the result will be the Test URL itself (not redirected) – thereby you can verify that no unwanted redirects are made.

Instead of making a redirect for each of the four variants of the URL, by using regular expression, we’ve created a single rule, which can redirect any possible variant of the URL of the specified pattern.

Regular expression - Example 2

In this second example the following six “From URLs” should be redirected to the “To URL”.

From URLs:
/pi/Bosch-36V-4-5Ah-Lithium-batteri_4902_4181.aspx
/pi/Bosch-36V-4-5Ah-Lithium-batteri_4902_.aspx
/pi/Bosch-36V-4-5Ah-Lithium-batteri_4902_4236.aspx
/pi/Bosch-36V-4-5Ah-Lithium-batteri_4902_4234.aspx
/pi/Boreting-batteri_4902_4236.aspx
/pi/Boreting-batteri_4902_4234.aspx

To URL:
/pi/Bosch-36V-4-5Ah-Lithium-batteri-_431901_21566.aspx

Again, this can be accomplished by specifying the “From URL” as a regular expression:
\/pi\/.*batteri_4902_[0-9]*\.aspx

This regular expression matches any URL with the structure:
/pi/[any characters or nothing]batteri_4902_[any number or nothing].aspx

Once again, the “To URL” should be specified as
/pi/Bosch-36V-4-5Ah-Lithium-batteri-_431901_21566.aspx

Once again, by entering the variants of the “From URL”, you are able to verify that the regular expression makes the redirect correctly.

Groups

Regular expression and groups can be used to restructure the “From URL” to a “To URL”.

Let’s say we have an old shop where a page exists for each manufacturer, displaying products by this manufacturer. In the new eSeller Cloud we’d like to make a redirect so that each of these manufacturer pages now redirect to a search result page for a search query on the manufacturer.

In the old shop these URLs had the following structure:
/list/manufacturers/Bosch.aspx

- and now I’d like these to redirect to something like this:
/products/productlist.aspx?searchtext=Bosch

In order to accomplish this, I set up a regular expression as the “From URL”:
\/list\/manufacturers\/(.*)\.aspx
- note that the characters inside the parenthesis make up a group.

As the “To URL” I specify the following:
/products/productlist.aspx?searchtext=$1
- note that $1 refers to the group specified in the regular expression.

When I enter the Test URL /list/manufacturers/Bosch.aspx, it is apparent that this is now redirected to perform a search of the manufacturer.

Testing tool

The testing tool allows you to test whether a URL is matched by any of the redirects in the shop and thereby determining if the 301 redirects in your shop are adequate and matches the URLs needed. This is especially useful in situations where you have 301 redirects, which consist of regular expressions – in these cases the tool can help you create transparency and determine whether your regular expressions match all the necessary cases.

Simply enter a URL – a search among all 301 redirects is immediately done.

If a match is found, the matched redirect is displayed and by clicking the search icon, you are able to find the redirect and view details/edit it. Note that if several 301 redirects match the entered URL only the one with the highest priority (lowest number) is displayed.

If no match is found, the entered URL is not redirected in the shop.

Importing and exporting 301 redirects

When setting up redirects in a shop it often makes more sense to import these to the shop as a CSV document. This can easily be done using the import wizard. In order to ensure that the CSV file has the correct format, you can download a template, which you can fill out with your redirects and import to the shop.

Importing 301 redirects

Go to Base setup > General information > 301 redirects. To get the template, click the “download this template” link – a CSV file is automatically downloaded to your computer.

The template contains the columns “From URL”, “To URL”, “IsRegularExpression”, “PassQueryParameters” and “Priority”. Moreover, the file contains a single row, displaying an example redirect – remember to delete this example row before importing the file.

If you wish to import a CSV file containing 301 redirects, click the “IMPORT” button.

Select the CSV file you wish to import and click “Upload file”. Verify that you have uploaded the correct file by checking the “Original filename”.

Click NEXT

Ensure that the file format is correct and that the example, which is rendered below looks correct – Click NEXT.

Now, map the columns in your CSV file with the columns in eSeller Cloud. Note that only the “ToUrl” and “FromUrl” are required.

If the PreserveQueryParameters and IsRegularExpression columns are omitted, the default value is 0 (false) and if the Priority column is omitted, the default value is 9999.

IMPORTANT: Note that you must specify whether the imported data should be added to the existing redirects or if any redirects not in the imported file should be deleted. If the checkbox is NOT checked, all existing redirects in the shop will be deleted and overwritten with the redirects in the imported file.

Click NEXT

Now, click “ACCEPT” – Note that the import will begin when you click ACCEPT.

Once the import is complete, the final step will display how many rows (redirects) were imported.

Exporting 301 redirects

All existing 301 redirects in the shop can be exported as a CSV or XML file. This is done by clicking the “EXPORT” button at Base setup > Company info > 301 redirects.

Select the columns that should be included in the CSV file.

Select which format to use – CSV or XML.

Click “Export” to download the file.

Preventing redirect loops

Note that in order to prevent redirect loops eSeller Cloud supports 301 redirect chains of maximum 5 redirects. If a redirect chain is made up of more than 5 redirects, the shop will redirect the user to the 404 page.

301 redirects and special characters

If your URLs contain special characters (non-ASCII characters such as æ,ø,å) or characters that are URL reserved, they must be encoded or optionally the redirect must be created as a regular expression where a wildcard is used to escape any such characters in the URL.

Examples:
/pl/hængelåse_22023.aspx >> /pl/h%C3%A6ngel%C3%A5se_22023.aspx
or
\/pl\/h.ngel.se_22023\.aspx (regular expression)

Reserved paths

URLs containing paths starting with /SL/, /images/ or /media/ cannot be redirected using 301 redirect, as these paths are reserved for internal operations.