Jump to content

Wire404Exception and PagePathHistory


dreerr
 Share

Recommended Posts

Dear Communiy,

My template basic-page does have URL segments activated. The segments are used to handle a different URL for the files attached. If a file is not found a Wire404Exception() is thrown. Sadly PagePathHistory does not handle it correctly (in my opinion) and old URLs no longer are redirected to the new ones.

wire/modules/PagePathHistory.module:117

/**
* Hook called upon 404 from ProcessPageView::pageNotFound
*
*/
public function hookPageNotFound(HookEvent $event) {

$page = $event->arguments[0]; 

// If there is a page object set, then it means the 404 was triggered
// by the user not having access to it, or by the $page's template 
// throwing a 404 exception. In either case, we don't want to do a 
// redirect if there is a $page since any 404 is intentional there.
if($page && $page->id) return; 

[...]

The documentation makes sense here but is the opposite of the desired effect.

Only solution for my problem was to disable the if-Statement, is there a better way to do this?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...