WordPress.org

Ready to get started?Download WordPress

Forums

non-canonical permalinks (1 post)

  1. alif
    Member
    Posted 7 years ago #

    Greetings,
    I don't quite understand how the WordPress 4.0.2 handles permalinks' requests.

    I understand the rule of .htaccess, mind you, but what I don't understand is how it determines either that:

    case1: The request is a permalink so it displays the single_post page along with comments (in my setting), or

    case2: that although the request was redirected internally to the URI parameters identifying the post, the request is not The Permalink and as such the post is displayed but not in a single_post fashion, and with no comments; as if in an archive page.

    I discovered also that unless the rewrite in .htaccess is an external redirect (either 301 or 302), the client gets a 404 status, while in fact the page displayed contains the post!

    I use verbose rules by setting:

    var $use_verbose_rules = true

    in class WP_Rewrite in classes.php because I have rules in my .htaccess that receive redirects from my blog at Blogspot and tries to redirect them to WP. Like this:

    RewriteRule ^atom.xml /atom/ [NC,R=301,QSA,L]
    RewriteRule ^([0-9]{4})_([0-9]{1,2})_[0-9]{1,2}(_zamakan)?_archive.html? /$1/$2/ [NC,R=301,L]
    RewriteRule ^([0-9]{4})/([0-9]{1,2})/(.+).html? /index.php?year=$1&monthnum=$2&name=$3 [NC,L]

    and my permalink structure is:

    /%year%/%monthnum%/%day%/%hour%%minute%%second%

    try for example http://zamakan.gharbeia.org/2005/04/blog-post_26.html
    which leads to the correct post but with a 404 error, unless I set the third rule above to:

    RewriteRule ^([0-9]{4})/([0-9]{1,2})/(.+).html? /index.php?year=$1&monthnum=$2&name=$3 [NC,R,L]

    then it works by redirecting to http://zamakan.gharbeia.org/index.php?year=2005&monthnum=04&name=blog-post_26

Topic Closed

This topic has been closed to new replies.

About this Topic