redirect – Check if a page/post exists, if not check another path before returning 404

Question

I’d like to check if a page or post exists and if it doesn’t to check another path that the page/post may be in.

For example, if I request the page/post ‘jacob-smith’ and if it doesn’t exist, it checks if ‘jacob-smith’ is in ‘staff/jacob-smith’ and if yes, it redirects the user.

What’s the best way of doing this?

0
Motivated 2 months 2023-04-03T00:21:31-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse