NEW YORK (AP) -- This is the end. Unless that is the end.

Since opening last week, the apocalyptic comedy "This Is the End" has earned $33 million at the box office, making it one of the biggest hit comedies of the year. But despite its name, the rapture riot by writer-directors Seth Rogen and Evan Goldberg struggled to find its conclusion, and even had to reshoot the film's final absurdist minutes.

(The rest of this article discusses the movie's ending, so avert your eyes if you'd like your laughs unspoiled.)

In "This Is the End," a fiery apocalypse arrives while Rogen, James Franco, Jay Baruchel and others (all playing themselves) are at Franco's Hollywood Hills home for a party. Some of the public has been raptured into heaven, but the actors are left to fend off demons while supplies dwindle and their Hollywood friendships fray.

Eventually they realize that they, too, can make it into heaven if they redeem themselves with altruistic acts. Some die horribly, but "This Is the End" originally concluded after two of the friends are beamed up into heaven. But when the film was test screened, audiences were miffed at not following the characters into the great beyond.

"Overwhelmingly people were like, 'What happens in heaven? What happens in heaven?'" Rogen said in a recent interview. "We had shown people so much crazy (expletive), we didn't expect them to want more."

The filmmakers quickly realized they had blundered. Rogen and Goldberg (who also co-wrote "Superbad" and "Pineapple Express") had actually first scripted a heaven scene, but cut it because they thought it was cheesy. (It featured smoking weed with Elvis and dancing with Marilyn Monroe.)

The two went back to the scene and brainstormed a new version. They came up with an answer to all their troubles: the Backstreet Boys. The film ends with a cameo from the band performing "Everybody (Backstreet's Back)" among the clouds at the pearly gates. (The tune also plays earlier in the film when Seth and Jay are hanging out.)

Story continues

Though all five members of the boy band are still alive, they've presumably been raptured into heaven. In a movie that playfully and continuously ups the surrealism, it's a final flourish of ridiculousness. When the group was approached about doing the cameo, the trailer for "This Is the End" was already out online.

"They had actually seen it," says Rogen. "So when we called them and asked them to be in it, they already knew what the movie was and existed and were excited about it. So it was actually really not that hard. They were super psyched about it."

Whereas the upcoming Brad Pitt zombie thriller "World War Z" has made headlines for having to redo its entire third act with a $20 million-plus reshoot, Rogen and Goldberg reshot their ending with considerably less fanfare.

Says Rogen: "We solved our problem with one day involving a boy band."

___

Follow AP Entertainment Writer Jake Coyle on Twitter at: http://twitter.com/jake_coyle