• Resolved diabolus

    (@diabolus)


    hi….

    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)
  • open 404.php file at your theme and replace code by the following:

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

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

    Thread Starter diabolus

    (@diabolus)

    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>
    </div>

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

    Thread Starter diabolus

    (@diabolus)

    moshu,

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

    https://wp101blog.info/diabolus

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

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

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

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

    so please tell me?

    Thread Starter diabolus

    (@diabolus)

    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.