Support » Fixing WordPress » Redirect to main page

  • Resolved diabolus



    i’ve searched around this forum but still can’t get the answer. so, i wanna redirect the error 404 to main page, and not to 404 page of wordpress theme. please tell me.

    any help would be highly appreaciated

Viewing 6 replies - 1 through 6 (of 6 total)
  • Outrix


    open 404.php file at your theme and replace code by the following:

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



    Deleting the theme’s 404 file doesn’t do exactly that?



    thanks, but my wordpress theme does not have 404.php file ! the 404 error controlled through code something like below:

    <div class="contentbody">
    <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>

    …it exist in the index.php file of my wp theme.



    Actually, I don’t think that’s a “404” error. It’s more like an invalid query inside WP.

    You get a 404 when a file is not where you are looking for; e.g.




    i mean exactly like in your site, when i requested a page that does not exist like:

    ..then i get message:

    Not Found
    Sorry, but you are looking for something that isn’t here.

    it exactly happened in my blog. so i want when typing : (a page that does not exist)

    then i/we will be redirected to main page:

    ..and these message, of course, will not be appeared.

    so please tell me?



    Resolved 🙂

    i get the right advice at Stop Losing Visitors to 404 Error Pages

    …using .htaccess ! sorry for this stupid poblem, but thanks alot for reading this post :))

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Redirect to main page’ is closed to new replies.