• Occasionally, if someone enters an incorrect URL (ie https://www.hrgazette.com/wrong) they get a page not found error.

    Is there a way to redirect incorrect URL’s to my homepage? Something generic that tells my domain or WordPress to just send them to the homepage?

    Just curious…

Viewing 2 replies - 1 through 2 (of 2 total)
  • Use something like this as your theme’s 404.php file (create one if there isn’t one already):

    <?php
    header("HTTP/1.1 301 Moved Permanently");
    header("Location: ".get_bloginfo('url'));
    exit();

    Redirecting all 404s to your home page is ill advised on a number of levels – from usability, to tracking, to SEO. Plenty of articles on the web about how best to handle them.

    Thread Starter TBakerHR

    (@tbakerhr)

    Ah…ok. Gotcha. I’m still learning something new every day ??

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Redirect wrong URL's to homepage?’ is closed to new replies.