XF 2.1 Broken post links due to change in pagination after post delete

Mr Lucky

Well-known member
Does anyone know how to deal with broken post links after you delete some previous posts on an earler page.

For example this post at the top of page 2

Code:
https://cafesaxophone.com/threads/lee-allen-new-video-transcription-and-analysis.28053/page-2#post-436957

Will no longer work if I delete a post on page 1, because that post then becomes a post on page 1 and #page 2 part of the link is obsolete.

When that happens the link just links to page 2.

Apart from manually creating redirects, is there a way round this?

Thanks
 
Last edited:

Chromaniac

Well-known member
right. this is the reason why xenforo does not use # based urls for individual posts...

https://xenforo.com/community/threads/broken-post-links-due-to-change-in-pagination-after-post-delete.183884/post-1450703

this basically redirects to the post number 1450703 even if the post was moved to another thread in a completely different section.

the other permalink format which i personally like is:

https://xenforo.com/community/posts/1450703

hard to say if a regex find/replace could fix the urls with # in them to one of these formats.

advice your forum members to copy the link from date/post-number when sharing specific posts. copy pasting url from address bar would cause this issue sadly.

or here is a crappy and risky alternative 🤔 do a find and replace in post table. replace all instances of page-2#post with post. but this would need to be done with multiple page numbers. and hard to say if it could actually break unrelated content. so maybe not do this and wait for someone else who might have a better idea. :p
 

Mr Lucky

Well-known member
this basically redirects to the post number 1450703 even if the post was moved to another thread in a completely different section.
That's what I thought should happen, but it isn't. Once the post is removed from page 2, ie it is now on page 1 due to a deletion, but the link does NOT redirect. ie the link doesn't go to the post on its new page, it just goes to page 2.
 

Chromaniac

Well-known member
links with # would not redirect. xenforo post include links without # in them. you can check by copying links from timestamp or post number right here. your users are copying urls from addressbar sadly. these links would have to be modified. if posts are no longer on the page they were at the time of copying of link from the addressbar.
 
  • Like
Reactions: NqM

Brogan

XenForo moderator
Staff member
Will no longer work if I delete a post on page 1, because that post then becomes a post on page 1 and #page 2 part of the link is obsolete.
The #page2 is only part of the link because it's on page 2.

The actual URL for that post is: https://cafesaxophone.com/threads/lee-allen-new-video-transcription-and-analysis.28053/post-436957, which will work no matter where the post is.
 
Top