• Hi,
    I ‘m using this as the template for permalinks in Options|Permalinks:
    /archives/%year%/%monthnum%/%day%/%postname%/
    This results in very long URLs for permalinks, which are wrapped (and broken) in most mailers. I’d like to refer to my posts (and offer links) with shorter URLs, but also keep the existing longer URLs for searching purposes.
    Is it possible with the current rewrite rules generated by this template ? If it’s not, what additional rules would I need ? As you may have guessed, I’m not too good with regular expressions ?? Here’s my rewrite rules:

    RewriteEngine On
    RewriteBase /wp/
    RewriteRule ^archives/category/(.*)/(feed|rdf|rss|rss2|atom)/?$ /wp/wp-feed.php?category_name=$1&feed=$2 [QSA]
    RewriteRule ^archives/category/?(.*) /wp/index.php?category_name=$1 [QSA]
    RewriteRule ^archives/author/(.*)/(feed|rdf|rss|rss2|atom)/?$ /wp/wp-feed.php?author_name=$1&feed=$2 [QSA]
    RewriteRule ^archives/author/?(.*) /wp/index.php?author_name=$1 [QSA]
    RewriteRule ^archives/([0-9]{4})?/?([0-9]{1,2})?/?([0-9]{1,2})?/?([_0-9a-z-]+)?/?([0-9]+)?/?$ /wp/index.php?year=$1&monthnum=$2&day=$3&name=$4&page=$5 [QSA]
    RewriteRule ^archives/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([_0-9a-z-]+)/(feed|rdf|rss|rss2|atom)/?$ /wp/wp-feed.php?year=$1&monthnum=$2&day=$3&name=$4&feed=$5 [QSA]
    RewriteRule ^archives/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([_0-9a-z-]+)/trackback/?$ /wp/wp-trackback.php?year=$1&monthnum=$2&day=$3&name=$4 [QSA]
    RewriteRule ^feed/?([_0-9a-z-]+)?/?$ /wp/wp-feed.php?feed=$1 [QSA]
    RewriteRule ^comments/feed/?([_0-9a-z-]+)?/?$ /wp/wp-feed.php?feed=$1&withcomments=1 [QSA]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter _mf_

    (@_mf_)

    Stevarino: Right on! Your second version did it for me. I also see the Comments link is updated.
    Do you think there would be something similar to be able to provide shorter trackback URLs too ? Do trackbacks work with only a post number ?

    Hm, never tried this myself, but under the “options” tab in /wp-admin/, click “Permalinks”. In the textfield try typing this:
    /%post_id%/
    That should do it I believe. ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to have a shorter URL for permalinks ?’ is closed to new replies.