• Resolved madivad

    (@madivad)


    I have my domain setup using permalinks in the form:

    https://myurl.com/article/{postID}

    I have a few pages that have custom slugs, but mostly they are as above.

    So if someone knows an article number they could simply type: https://myurl.com/article/1223

    What I want to be able to achieve is to use an even shorter url so that someone need only type https://myurl.com/1223 and it gets redirected to the article https://myurl.com/article/1223.

    No slugs in my naming scheme are numbers only, so there wont be any clashing with existing pages.

    The test could be something about only having a number after the url and use that to locate the article.

    I’m using WPMU and I really think there would be a way to achieve what I want in wordpress itself (either by plugin or coding it myself), or (as a last resort) playing with the redirect rules, which I have never understood.

    I’m hoping someone out there has some insight

    TIA! Dave

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Hm. Out of the box, myurl.com/?p=1223 would work, but you want it to be pretty, I take it?

    Technically canonical redirects would already redirect /%postname%/ to /article/%postname%/ for you, but not the post IDs.

    You COULD get around this with a .htaccess redirect.

    RewriteEngine on
    RewriteRule ^([0-9]+)$ /article/$1 [L]

    Mind you, that may break any year/month/day archives.

    Thread Starter madivad

    (@madivad)

    In the end I just dropped the “article” slug, that works for me ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘redirect rule for shortened url to permalink’ is closed to new replies.