[resolved] Redirect to main page (7 posts)

  1. diabolus
    Posted 8 years ago #


    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

  2. Outrix
    Posted 8 years ago #

    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'));
  3. moshu
    Posted 8 years ago #

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

  4. diabolus
    Posted 8 years ago #

    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.

  5. moshu
    Posted 8 years ago #

    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. yourblog.com/moshu.html

  6. diabolus
    Posted 8 years ago #


    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 :

    http://wp101blog.info/diabolus (a page that does not exist)

    then i/we will be redirected to main page: http://wp101blog.info

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

    so please tell me?

  7. diabolus
    Posted 8 years ago #

    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 :))

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.