Caroline Wirawan
Caroline Wirawan

Reputation: 11

mysql replace add trailing slash to url

Im struggling with this problem for 3 days since i dont know any coding or regex of etc

i have a wp streaming site with iframe content, the iframe source already in https

now i want to migrate my streaming site to https but when i try to do that, there a lot of movies that cant play, and after i checked, the problem is the iframe url

The movies works ok if the iframe has trailing slash https://example.com/embed/pMVg9liYw9gTvL7/

but without trailing slash, the movies wont load https://example.com/embed/pMVg9liYw9gTvL7

What i want to achieve is to add trailing slash at the end of iframe url from mysql.

please help Thanks

Upvotes: 0

Views: 1310

Answers (1)

Barmar
Barmar

Reputation: 780909

I usually don't like to answer questions that show no attempt, but this one is so simple that it's easier to answer than post complaints.

Use a simple UPDATE statement.

UPDATE yourTable
SET url = CONCAT(url, '/')
WHERE RIGHT(url, 1) != '/'

Replace yourTable and url with the name of your table and the column holding the iframe URL than needs to be fixed.

Upvotes: 3

Related Questions