I've noticed that a lot of (especially older) content on Meta (and other places) which links directly to other content on the same site, following the link results in a 404 error. Especially since the link target and destination are both on the same site, it seems like it would be especially possible for a script to run periodically and add strikethrough formatting to dead links.

Notice that I am not proposing either of the following:

  • A system for notifying AUTHORS of broken links in their posts to try to get them to fix something, as is proposed here.
  • A moderation queue where people who come across broken links can report them for MANUAL moderation, as suggested by Shadow Wizard.

I am instead proposing an AUTOMATIC way to format text to visually help READERS not waste their time clicking on dead links.

  • Do you have some examples of postings that link to 404 pages?
    – Uwe Keim
    Commented Mar 28, 2015 at 16:42
  • For example, in a discussion around some bugs in tag creation, see this question and the "Related" post with Jon Seigel, which is 404. I'm not saying that I should be personally going through and finding examples of dead links for manual editing; I'm proposing that a bot help address the problem more generally.
    – WBT
    Commented Mar 28, 2015 at 18:14
  • 2
    Long story short: there was an experimental "broken links" review queue, it didn't work and was aborted. Don't think it will be back, so more likely status-declined at some point. Commented Mar 28, 2015 at 18:49
  • I want to point out that this feature-request is different from the proposed dupe because it only takes the links to posts ON THE SAME SITE into account which is different from the dupe that simply wants to fix all broken-links.
    – rene
    Commented Mar 30, 2015 at 19:46
  • Rene: That's not accurate. This is different from the proposed dupe because it's fixing a different problem for a different beneficiary, and does so by an automatic mechanism that does NOT require manual editing steps by users who may no longer be paying attention.
    – WBT
    Commented Mar 30, 2015 at 22:29
  • I've voted to close as dupe. While there is a slight difference, yours is to make any user visually aware a link is dead, and the other is to notify link owners to fix bad links, the basic premise is the same - that is to identify broken links. As "searching sites and check for bad links" would be fairly hefty system to develop (etc) it would be a shame to have two different ideas to the same proposed system lurking separately. It would be better all round if you answered the other question with your idea, then all ideas can be locally collated.
    – James
    Commented Apr 5, 2015 at 16:06

1 Answer 1


I don't expect this to be implemented however your take on reducing the huge problem of link rot to just links within this site made me experiment with SEDE to get posts on Meta that link to posts on Meta that are deleted.

The following query does that:

declare @sitebaseurl nvarchar(40) = N'https://meta.stackexchange.com/questions/'
declare @pattern nvarchar(60) = N'%'+ @sitebaseurl + N'[0123456789]%'
declare @closingtoken nvarchar(20) = N'%[/"#? <)'+char(10)+N']%'
declare @sitelen int = len(@sitebaseurl)

select --  top 1000  -- reduce results in case of timeout
       p.id as [Post Link]
       , substring( p.body 
       , patindex(@pattern, p.body) + @sitelen -- spos
       , patindex(@closingtoken, substring(p.body,patindex(@pattern, p.body) + @sitelen, 8)) -1 -- epos
       ) as link
from posts p
left outer join posthistory ph 
  on ph.postid = cast(substring( p.body 
       , patindex(@pattern, p.body) + @sitelen -- spos
       , patindex(@closingtoken, substring(p.body,patindex(@pattern, p.body) + @sitelen, 8)) -1 -- epos
       ) as int)
where body like @pattern
and ph.id is null

###How does this work? I used a like to find posts with links to https://meta.stackexchange.com/questions/ and find the position of the url in the body by using patindex to find the end of the postid that follows.
By performing an outer joins with the PostHistory table on postid based on the cast to an int of the postid that is obtained via the substring function. If no record exist the link is pointing to a now deleted post. I used the PostHistory table instead of the Posts table because migrations to other sites are in the PostHistory table. Those links still work.

Notice I have some false positives and if the post contains multiple links my query will only check the first one. At this moment it returns 1516 posts that have links to deleted posts.

Why is this query useful? We might take those posts on to either fix the links to point to better posts, undelete the linked post or remove the post if it lost its value or do as you propose, strike through the link.


Not the answer you're looking for? Browse other questions tagged .