Community

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
chriscas
Community Member

Global url replacement in html

We have an existing LTI where we'd like to change the URL (don't want to get into too many details about that, but I can, if necessary).  The problem is this LTI can embed content through the RCE, so any existing content will have the old URL, and end up not functioning properly because of the update.

Short of trying to build some kind of script to crawl through every Canvas shell we have, and try to look at every possible content area via API, does anyone have an idea of how we could get the URLs updated?

With my database hat on this would be a simple find https://blahblah and replace with https://yahyah, but I don't know if Instructure would even be willing to do this (and we don't really have extra money to pay for professional services to tackle this, even if they could).

5 Replies
James
Community Member

I hope someone has a better solution or at least someone may have already written code to do this.

I wrote a PHP script in May 2015 to handle changnig all the links from the old guides to the new Community. I took the approach you mention, but I only had to do it for pages, so it wasn't as complicated. You might be able to use CanvasData to narrow down the places where it needs changed and that would speed things up.

saelterman
New Member

Here's just some brainstorm: I am assuming you have some lead time, maybe even a period where both URLs will be active. Can you at the old URL keep a log of where visitors came from and use that log to make the API calls to update to the new URL? You would of course need control over the LTI solution, or at least over the server that's running it.

garth
Community Member

chriscas‌ not knowing anything about what you're doing, I'll throw out this idea: on the LTI webserver can you redirect the old URL to the new URL?  Or, map the old URL to the new URL?  Depending on exactly what the scenario is, you might be able to handle this through DNS.

Hi James,

Can you expand on this PHP script you wrote? I would kill for a way to do a global search and replace in a course's HTML, even it were only in pages. I've got over a dozen courses with around 250 pages each. Each page has an iframe tag pointing to a URL I'd like to change globally. Thanks in advance.

Hi again,

Kindly disregard my post from yesterday. I'm ecstatic because I've found a way to do a global search and replace using API from this site: GitHub - drlippman/canvas-scripts: Sample PHP scripts for working with Canvas LMS via API and common... 

This is life-changing!