# Post Links Broken



## Cleon (Aug 26, 2019)

Just noticed a problem with the upgrade.

While we can still link to posts using [POST]name[/POST] - for example, *[POST=7785890]No XP/Laughs[/POST]* links to No XP/Laughs? - now some of the links in my old posts are broken.

For example:



Cleon said:


> Updating *Screaming Child Working Draft*.




The link goes to https://www.enworld.org/index.php?posts/7591319/ (although it can be fixed by deleting the "new" and opening "enworld.org/index.php?posts/7591319/"

More worryingly, one of my most important posts has lost ALL its post links, which have become "https://www.enworld.org/index.php?POSTs":



Cleon said:


> *Completed Creatures Awaiting Upload to CC*
> Albino Wyrm (Dragon-Kin)
> Alkada, Walking Egg
> Alkada, Wingless Wonder
> ...




I hope I'm not going to have to fix them by hand - there's literally hundreds of them!


----------



## jmucchiello (Aug 26, 2019)

I'll be surprised if that gets fixed at all. vBulletin had a post URL for handling post requests. Xenforo seems to only do posts through #anchors on the thread URL. So the old post would just rewrite a URL of post?p=nnnnn and the post.php would look up the thread for the post and all that other jazz. Look at the link you posts to No XP/Laughs. There are two numbers inside, the thread number and the post number. There's no easy way create an equivalent unless Xenforo adds a posts URL that doesn't need the thread id.


----------



## CapnZapp (Aug 26, 2019)

Could it simply be that the software was installed when the server used "new" in the web address, and some setting just needs to change to "www"?


----------



## jmucchiello (Aug 26, 2019)

No. The post URL in Xenforo is ".../thread/name_of_thread.123456/post-789789". The [post] tag only has the 789789 in it. You would need code to turn that into the 123456. 

In vBulletin, the post URL was ".../post?789789" and thus you could generate the post URL with only the number.


----------



## CapnZapp (Aug 27, 2019)

So what you're saying is that you can't use the post tag?

(Because if all you have is the 789789 you yourself said that's enough, if you can use that method)


----------



## Morrus (Aug 27, 2019)

I've no idea how that could have happened. @darjr, any ideas?


----------



## darjr (Aug 27, 2019)

Looking at it. Might be able to fix them in the database. Just gotta work out the query. Replacing new with www is the easy part. Do they work if it’s just that that is replaced? Also may have to bring back new and add it to the ssl domain list.


----------



## jmucchiello (Aug 27, 2019)

You can update all the existing [post]s and turn them in full links. But that doesn't return the functionality to enworld.


----------



## Morrus (Aug 27, 2019)

Yeah, don't just find/replace "new" with "www". "New" isn't exactly an uncommon word!


----------



## darjr (Aug 27, 2019)

Ha! No I’d look specifically for https://new.enworld at least


----------



## Morrus (Aug 27, 2019)

There's probably a few find/replaces we need to do. Some BBcodes changed with the new software.


----------



## jmucchiello (Aug 27, 2019)

Well, yes, Mention -> User has been mentioned elsewhere.

EDIT: I just did some tests. Apparently, .../posts/nnnnnn works. It creates a redirect URL to .../threads/name.mmmm/#post-nnnnnn. So [post] can be supported without doing a full search/replace of the database. You just need to setup the URL rewrite in the BBCODE configuration.


----------



## Cleon (Mar 23, 2020)

I'm still finding many links that don't work because they have "new.enworld.org" instead of "enworld.org" at the start of their http address.

Any change of fixing this?  I don't fancy going through all my lists and indexes and changing them by hand!


----------



## darjr (Mar 23, 2020)

I’ll take a look tonight. Though it might be a very intense query and if so require the site be down for a bit, if so it’ll not happen until later in the week.


----------



## Morrus (Mar 23, 2020)

Yeah, a global search replaces on a post table this size takes the site out for everybody for a while.


----------



## jmucchiello (Mar 23, 2020)

In theory you can run the search part to get a count of the number of posts affected to determine how long it would take to run. It could also write the post ids of the affected posts to a separate table so that when you run the query again later, it only have to join with the separate table and not search every post again.

The query could be further optimized to just grab the top 500 posts at a time so it could be run while the site it up over the course of several runs:

begin transaction
insert into temp (postid)
select top 500 postid from list_of_postids_from_prior_search

-- loop through temp updating posts however that would be done

delete from list_of_postids_from_prior_search where postid in (select postid from temp)
commit

When the list_of_.... table is empty, you stop running the query. And the 500 can be run with a conservative value of 1 the first time so you can verify the resulting post isn't mangled.

It would also be nice if all the [SBLOCK=""] could be converted to [SPOILER=""] globally.


----------



## darjr (Apr 12, 2020)

These have been modified, please confirm.

Thanks!


----------



## jmucchiello (Apr 12, 2020)

What have been modified?

Plain version

 [Post="7278746"]Perin Wolfrider[/Post]
 [thread="601348"]IC[/thread] [Thread="598748"]RG[/Thread]

Real version

 [Post="7278746"]Perin Wolfrider[/Post]
 [thread="601348"]IC[/thread] [Thread="598748"]RG[/Thread]


----------



## darjr (Apr 12, 2020)

```
http://new.enworld.org
```
 to 
	
	



```
https://www.enworld.org
```
 see the original post.

Looking at the posts in your post now.

Thanks!


----------



## darjr (Apr 12, 2020)

@jmucchiello I don't under stand what you meant by your post?


----------



## jmucchiello (Apr 13, 2020)

Neither do I understand you. this thread was about fixing all the [thread] and [post] links that were not ported from vBulletin. Some of the [url] links became new.enworld.org. But that doesn't fix the [thread] and [post] tags in many forum posts.


----------



## Cleon (Apr 13, 2020)

darjr said:


> These have been modified, please confirm.
> 
> Thanks!




Thanks Back!

That seems to have fixed it. I did a search of the "view page source" for some old threads, including the one I noticed the problem. No "new.enworld.org" text strings appeared so it looks like that particular problem's been solved.

Did notice a few other broken internal links, all rather old ones that still included a forum in their addresses.

For example, the "Original thread" link in the first post of the *Converting Monsters from Dungeon Magazine (Part Two)* thread is a broken link to http://www.enworld.org/forum/general-monster-talk/78935-converting-monsters-dungeon-magazine.html rather than the  Converting monsters from Dungeon Magazine working link to Part One.


----------



## darjr (Apr 13, 2020)

I’ll take a look. Could you do me a favor though and start a new thread on the topic? Thanks!


----------



## Cleon (Apr 13, 2020)

darjr said:


> I’ll take a look. Could you do me a favor though and start a new thread on the topic? Thanks!




Sure.

I've started a thread titled *Old Broken Forum Links*.


----------

