fixing broken links?

cwe

Well-known member
One of my forums has accrued hundreds, maybe thousands, of links to a 3rd party (niche) news site over the last decade or so. Recently, that news site got hacked, went offline for a week or so, and has now returned, but returned rebuilt (new structure) and throwing 404 errors for all the links posted in my forum.

I would like to disable all those links so that they show as plain text and not live hyperlinks. Is there an easy way to do this without having to find and edit each one manually one at a time?
 
Admincp > tools > rebuild cache of forum > save.

If that doesn’t work you might want to an aggressive reset of the hacked forum and start again.
Let your host know that it was hacked.
Email your users.
 
@Suzanne O - You misunderstood. It's not my site that was hacked. It was a 3rd party site on the internet that I do not own or have any affiliation with. I just have a lot of links to content that they had posted (which are not longer online - so a lot of links to 404 errors presently).
 
Replace xenforo.com in the code below with the name of the site and run the query, you're welcome. Of course whatever is left of the links may not be too appealing... but it'll do the job.

This query will update all rows in the table "your_table" by replacing 'https://xenforo.com' with an empty string ('') in the 'link' column.

Again, exercise caution when running update queries on a production database, and consider testing the query on a backup or in a safe environment first.


Code:
UPDATE your_table
SET link = REPLACE(link, 'https://xenforo.com', '');
 
removing domain name from link without removing URL would still keep the link alive. there is no easy fix for this except for maybe a complex regex that can remove the link bbcode around the links containing the domain. handling redirection and 404 is logically the responsibility of the third party site here. but i can understand why you would not like to point to dead links at your end.

one crappy way would be to update links to point to their archive.org version (https://web.archive.org/web/*/https://existinglinks) but that would also not help much because it's unlikely that all/most links are indeed archived on the internet archive database.
 
Top Bottom