6/16/2004 ↓

Better archives permalinks in WordPress 1.2

Thanks for visiting! If you're new here, you may want to subscribe to our RSS feed. This blog posts regular Wordpress news, updates of themes, plugins, ideas, hacks, quick fixes and everything about blogging, especially about Wordpress. Go ahead, subscribe to our feed! You can also receive updates from this blog via email.

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

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...
Sphere: Related Content | stumbleit |
Translate to German Translate to Spanish Translate to French Translate to Italian Translate to Portuguese Translate to Japanese Translate to Korean Translate to Russian Translate to Chinese

Latest Videos

Latest WordPress Jobs

One Comment | Leave a comment | Comments RSS

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

    Chmouel (3 comments.) — 07/15/2004 @ 8:28 pm

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

(required)

(required, will not be published)


S2