WordPress.org

Ready to get started?Download WordPress

Forums

How does WP normally handle archive uris? (2 posts)

  1. jamal26
    Member
    Posted 1 year ago #

    The standard archive uri for slug based permalinks seems to be:

    /year/month/ for instance this month is

    /2013/02/

    When I hack my own theme that uri will resolve to the home page. Is it up to my home page in my theme to do the proper forwarding? I think could do something like in home page template:

    $uri = $_SERVER['REQUEST_URI'];
    $a = explode("/", $uri);
    if (is_numeric($a[0]))
    {
    header('Location: /archives'.$uri ) ;
    exit();
    }

    Is that the way it's normally done? I could also use /archives/2013/02/ in my urls, but it seems a bit nonstandard.

    Thanks.

  2. bcworkz
    Member
    Posted 1 year ago #

    Take a look at Query Overview for how it is normally done. Whether you need to forward the request elsewhere or not would depend on how you intercept the current month request to go to your home page. If done properly, you shouldn't have to do anything. Any archive request outside the current month should get parsed normally. If this does not happen, I would suggest you are likely doing it wrong ;)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.