Devs – I need to get a particular page to return an error code (404 or anything else is fine), but ONLY when the user is on a mobile device.

[ad_1]

I’m racking my brain on this. I could just make it a soft 404 by hiding everything on mobile and adding a fake “Error 404 page not found” title at the top of the page, but I would prefer it if the page actually returned 404 when the user was on a mobile device. I don’t think the soft 404 will work for what I’m trying to do.

I’m thinking PHP is the only answer, but I’m hoping there’s an easier way to implement it. Let me know if you have any ideas. Thanks.

[ad_2]
2 Comments
  1. Something with user-agent will likely get the job done, server or clientside (PHP)

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer