Export redirects from Umbraco 8 sites
# help-with-umbraco
d
I need to use the Skybrud Redirects package on the v10 site. I want to export the redirects from v8 site and then import it using Skybrud.Umbraco.Redirects.Import package. How to export redirects from v8 site? Any pointers please
a
Hi @Debasish The import package currently isn't available for Umbraco 8, but I'd imagine it would take much to update the Umbraco 7 package to Umbraco 8. I will look into that. This way you'll be able to install the Umbraco 8 package for your old site, and then access the
/umbraco/backoffice/Skybrud/RedirectsExport/Csv
endpoint in your browser to download a CSV file with all existing redirects. The CSV file can then be imported on your Umbraco 10-site.
I've just pushed a v2.0.0 release that targets Umbraco 8: https://github.com/skybrud/Skybrud.Umbraco.Redirects.Import/releases/tag/v2.0.0 This is a "lesser" version of the Umbraco 10 package, as it doesn't actually support importing redirects. But like mentioned earlier, it does expose and endpoint for exporting all redirects. You can read more in the README here: https://github.com/skybrud/Skybrud.Umbraco.Redirects.Import/tree/v2/main
d
Hi @Anders Bjerner
Thanks for pointing me in the right direction. We are using the Url Tracker to manage the url redirects on the v8 site. Based on your inputs I was able to export the data as a csv by calling the endpoint /umbraco/backoffice/urltracker/urltrackermanager/exportredirects/
I am then trying to use this on the v10 umbraco site that has Skybrud installed. However the import process fails with following error 'Unable to parse a line in the JSON log file'
I'm thinking something is not appropriate in the csv file that I got from v8 site. Any suggestions please?
a
I don't really know about UrlTracker. But if you're exporting a CSV file, you should also import it as a CSV file. If you try to import it as a JSON file you will get errors. Anyways - the CSV import looks for a number of different columns, which might not match the columns in the CSV exported from UrlTracker. You can read more about the supported column names here: https://github.com/skybrud/Skybrud.Umbraco.Redirects.Import/blob/docs/v4/import/columns.md
I had a look at UrlTracker. The CSV export in UrlTracker only includes numeric IDs, which would be useless in many export/import/migration scenarios as they may differ across different environments. Maybe you can can convince @D_Inventor to include the root node keys and target node keys in the export from UrlTracker? Then I can see what I can do in my package to understand UrlTracker's CSV files.
d
I have been summoned 😅 . I have to agree, ids are rather useless in export and import scenario's. I'll see what I can do. It's gonna be an interesting one, because the URL Tracker doesn't do anything with keys afaik.
a
I haven't looked too much at the source code, but this might be a good place to start: https://github.com/Infocaster/UrlTracker/blob/5.2.3/src/UrlTracker.Web/Map/CsvMap.cs#L30-L59 The bottom method already looks up the
IPublishedContent
for both the root node and the target node.