Search code examples
http-status-code-301

301 redirect works in Firefox but not Safari or Chrome?


I have this simple redirect at the top of my htaccess to redirect a Wordpress category archive to a new page. It works on firefox but not other browsers. If I eliminate the category I get a 404 error.

Redirect 301 /category/forums-and-events/  /forums-and-events/

I've emptied the browsers' cache. What can I do to get it to work?


Solution

  • In Wordpress this works for redirecting to an absolute url and avoids htaccess:

    <?php
    wp_redirect( $location, $status );
    exit;
    ?>
    

    $location is the url to direct to, $status is either 301 (permanent redirect) or 302 (temporary)

    http://codex.wordpress.org/Function_Reference/wp_redirect