post-page

Better archives permalinks in WordPress 1.2

1
response
by
 
on
June 16th, 2004
in
Cool Scripts, WordPress Hack

I had a request on #wordpress to be able to use http://yourblog.com/blog/archives/cat_name/ as a category permalink instead of the default WordPress way of http://yourblog.com/blog/archives/category/cat_name/ and I think I might have come up with a way to modify your htaccess to do just that.

Set your permalink template as:
/archives/%year%/%monthnum%/%day%/%postname%/

Set your cat archives prefix as:
/archives

and use this file as your htaccess (or copy the contents to your htaccess) after replacing every instance of “blog” with the foldername of your blog. If you do not have your blog in a folder (installed into the root of your website) then remove every instance of blog/ in the following file.

http://weblogtoolscollection.com/b2-img/cat_htaccess.txt

heading
heading
One
Response

 

Comments

  1. Chmouel says:

    quite strangely for me it didn’t work with posts_nav_link() i had to do a dirty hack like that :

    NB: The add of SCRIPT_NAME

    diff -u “c:/unix/HOME/tmp/wordpress/wp-includes/template-functions-links.php” “c:/unix/HOME/www/wp/wp-includes/template-functions-links.php”
    — template-functions-links.php~ 2004-06-18 02:22:09.000000000 +0200
    +++ template-functions-links.php 2004-07-16 02:24:41.799187200 +0200
    @@ -344,7 +346,7 @@
    $qstr = preg_replace(‘|^’. $home_root . ‘|’, ”, $qstr);
    $qstr = preg_replace(‘|^/+|’, ”, $qstr);
    if ($permalink) $qstr = trailingslashit($qstr);
    – return preg_replace(‘/&([^#])(?![a-z]{1,8};)/’, ‘&$1’, trailingslashit( get_settings(‘home’) ) . $qstr );
    + return preg_replace(‘/&([^#])(?![a-z]{1,8};)/’, ‘&$1’, trailingslashit( $_SERVER[‘SCRIPT_NAME’] . “/” ) . $qstr );
    }

    function next_posts($max_page = 0) { // original by cfactor at cooltux.org

    Diff finished. Fri Jul 16 02:25:01 2004



Obviously Powered by WordPress. © 2003-2013

css.php