Blog

Custom Permalinks

200811011939.jpg

Custom Permalinks is a WordPress plugin that gives you ultimate control over your site structure.

Lay out your site the way you want it. Set the URL of any post, tag or category to anything you want. Old permalinks will redirect properly to the new address.

Support not available at this time: Unfortunately, I don’t presently have the resources to offer support for this plugin. Please direct questions to the WordPress forums

Note: This plugin is not a replacement for the inbuilt permalink settings: Custom Permalinks is designed to modify permalinks on a per-post/page/tag/category basis, not for all posts/etc at once. If you wish to alter your entire site structure, spare your sanity, and change the WordPress permalink settings instead.

Download

Download Custom Permalinks for WordPress from the Custom Permalinks WordPress plugin page.

If you like Custom Permalinks, please consider buying one of my products.

Installation

  1. Unzip the package, and upload ‘custom-permalinks’ to the ‘/wp-content/plugins/’ directory
  2. Activate the plugin through the ‘Plugins’ menu in WordPress
  3. Edit any post, tag or category to set a custom permalink.

Configuration

  • Open or create a post, tag, or category.
  • Under ‘Custom Permalink’, type in a URL, not including the http://domain part of the address.
  • Save

Now, the post/tag/category will be accessible at the custom address.

Incoming visitors from old links will be redirected via a 301 redirect to the new address.

See Custom Permalinks in action right here! (See the address you’re currently at?)

Notes

Interacting with other plugins which modify the URL

If you notice that some plugins, such as Keyvan Minoukadeh’s Paged Comments plugin, are not operating correctly, then ensure that your custom permalinks have a trailing slash (or not, if your standard permalinks do not have trailing slashes).

The Paged Comments plugin, and possibly others, work by adding a path component to the URL to signify state (eg. /comment-page-1), then hiding that path component from WordPress.

If you have a custom permalink with a different trailing / configuration to your normal permalinks (i.e., your custom permalink has a trailing / when others don’t, or vice versa), you will notice that these plugins no longer work, because Custom Permalinks is correcting the URL, which overwrites the plugin’s changes.

If you notice this happening, make sure you have a trailing / on your permalink, or remove the trailing slash if your standard permalinks do not have a trailing /.

Hiding the custom_permalinks custom field

A user recently asked for this; I’m not going to include it in the plugin (some people, including me, want to see this field, because we set it manually sometimes), but I’m happy to make a plugin-let to make it happen.

Here it is: hide_custom_permalink_field.php.zip

Put it in your wp-content/plugins folder and turn it on in Plugins under WP admin.

FAQ

I just get a “404 error” message when I try to visit a custom permalink

Have you configured your default permalinks to be other than the default “?p=123” style? If not, you probably haven’t got URL rewriting enabled. Either set your permalinks to one of the other options (or a custom layout), or add the following to your .htaccess file in your webroot, creating this file if necessary:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

, , . Bookmark the permalink. Both comments and trackbacks are currently closed.

59 Comments

  1. Nick
    Posted December 2, 2008 at 5:43 pm | Permalink

    Thanks Mike! I was able to figure it out. Your quick with this! So how did you insert the fancy little icon in the address bar for elegant grunge? I have a .ico but im not sure how/where to place it.

  2. Posted December 3, 2008 at 11:14 am | Permalink

    Nick, Cool! You need to call it ‘favicon.ico’, and put it either in the webroot, or in the ‘wp-content’ directory.

    I suggest you post any more questions over on the theme page, so others can see them, as this is page is for the Custom Permalinks wordpress plugin.

  3. alesto
    Posted December 4, 2008 at 5:28 am | Permalink

    Hi,Mike. I have some trouble with you plugin. When i added new post, custom permalinks saves in format ?p=48. But template of my permalinks is %category%/%postname%/ . And links in this format to the posts dont`t work. And i need fix custom link manually. My version of wordpress is 2,5.

  4. Posted December 11, 2008 at 1:51 pm | Permalink

    Just a note, this plugin appears to work fine in 2.7 – I just upgraded my blog and it seems to be working fine. Let me know if there are problems.

  5. Posted December 11, 2008 at 5:57 pm | Permalink

    Hi, last week I tried WP 2.7 RC1 and it seems the plugin had some sort of error wherein my custom permalinks got whacked.

    ex. http://www.newdemonstration.co.cc/quotes/etcetc/ becomes… http://www.newdemonstration.co.ccquotes/etcetc/

    the “/” for some reason gets appended deeming the link to be unreachable. Thus, I reverted back to WP 2.6.5 stable.

    Do you think this issue won’t appear on WP 2.7 Stable?

    • Posted December 11, 2008 at 6:01 pm | Permalink

      It’s hard to say – It works perfectly for me, after upgrading to 2.7 today. If you have a problem, let me know.

  6. ovidiu
    Posted December 11, 2008 at 6:49 pm | Permalink

    there are definitely problems. try writing a page, saving as a draft, re-editing, restoring an autosave, then finally publishing and it automatically gives that page a custm permalink, which you can only delete by going to manage = > custom permalinks, it doesn’t work directly from the write page tab…

    0.4 of your plugin and wp 2.7 final

  7. Posted December 12, 2008 at 2:07 am | Permalink

    Will try tomorrow. Hopefully I’m brave enough to do it by then. I don’t want it whacked again. It’s frustrating.D:

    Will report back by then.

  8. Posted December 13, 2008 at 5:10 pm | Permalink

    Same problem still persists.

  9. Posted December 13, 2008 at 5:18 pm | Permalink

    Righto. I’ll check it out soon.

  10. Posted December 14, 2008 at 4:06 am | Permalink

    Thank you. I appreciate that, and many others too I believe that use your plugin.

    Can’t wait to get on WP 2.7! I’m looking forward to it!:)

  11. Posted December 30, 2008 at 11:37 pm | Permalink

    Advanced Happy New Year!:)

    How’s the fixes going?

    • Posted December 31, 2008 at 10:15 am | Permalink

      Cheers ;) And same to you!

      Getting there with the next version, I’ve already fixed one problem – I’m just trying to sort through all the reports to try to replicate errors. I should have an update out in the next couple days – Will keep you posted!

  12. Posted January 5, 2009 at 2:01 am | Permalink

    Problem still persists with the .5beta that you’ve sent us.sob The back-slash after my site address still gets omitted for some reason.

    • Posted January 7, 2009 at 10:15 am | Permalink

      Damn. I’ll get back to you in a few days!

  13. Posted January 5, 2009 at 4:55 am | Permalink
    • Posted February 12, 2009 at 10:33 am | Permalink

      Hello! I’m very sorry for the hiatus – I got distracted for a while by some other things I had to do, but I’m back now. Is the plugin still not working for you?

  14. Posted January 6, 2009 at 7:26 pm | Permalink

    very good , tanx

  15. Posted January 19, 2009 at 3:21 am | Permalink

    It i nice to find this plugin working for 2.7, however, the download link from wp.org is not working, can you make a mirror here on your site?

  16. Bob
    Posted March 2, 2009 at 8:33 am | Permalink

    This plugin is exactly what I need! However, I can't get it to work. It installs fine, but my newly created URLs don't work. I keep getting errors that say "page not found". Any ideas on how I can fix this? As far as I can tell, there are no other plugins like this out there, and I desperately need it! Thanks for creating this.

    • Brenton
      Posted March 4, 2009 at 7:25 pm | Permalink

      Hi, thanks so much for this plugin! You rock! I don't understand why this isn't default for wordpress. I have the same trouble–404 errors all the way. :-\

      I look forward to when you get it updated for 2.7!

      • Posted March 5, 2009 at 6:15 pm | Permalink

        Hello Brenton! Are you also having troubles with the plugin under 2.7? (I'm running 2.7.1 with Custom Permalinks with no problems); Still haven't found time to investigate the other problems yet, I'm afraid – my apologies, it's definitely on the to do list still.

        • Brenton
          Posted March 5, 2009 at 9:28 pm | Permalink

          Yes, I was, but I did a re-design today and now I actually want them to be done by dates, so I uninsulated your plug-in–great though it is. :)

    • Posted March 5, 2009 at 6:28 pm | Permalink

      I'm sorry to hear that Bob! Can you let me know your WordPress/PHP versions, for starters? I'm aware that there are a few issues currently, and haven't yet had the opportunity to have a look at them.

      • Bob
        Posted March 11, 2009 at 8:05 am | Permalink

        It's actually 2.5.1 I know I should update, but I've only ever had horrible problems with updates. I use so many custom templates and hard-coding, it takes me forever to update. Should there be issues with your plugin and WP 2.5.1?

        • Posted March 11, 2009 at 8:32 am | Permalink

          Hmm I see! It seems quite probable that that's the problem – I can't really say for certain either way, because I haven't tested on 2.5, but I do know that the WordPress API underwent a few changes since then, and I'm probably making use of them, as Custom Permalinks gets into the guts of WP somewhat to work.

          One option is to copy your whole webroot over to a new folder, upgrade in there, and see if it works – then you can always roll back, or put the work in to upgrade (2.7 is brilliant, and well worth it in my opinion)

          • Posted March 17, 2009 at 8:57 am | Permalink

            I finally updated to 2.7, and I still have problems. Right now I use the default permalink structure, and I just want to make some pages have custom url's. Any more ideas of what could be wrong? I just get a "Page not found" error every time I try to use a custom permalink…

  17. Posted March 13, 2009 at 4:03 am | Permalink

    Hi Mike,

    I write blogs both in Chinese and English.Uunfortunately, my hosting company does not support utf8 codes on permalink, hence your plugin is perfect for my chinese posts.

    However, I can't get it to work like others. My WP version is 2.7.1. Whenever I changed the permalink, it keeps showing a 'page not found' error. Do you have some clues or solutions yet?

    Thanks for your help !

    cheers Shirls

  18. Posted March 13, 2009 at 9:20 am | Permalink

    Hi Shirls – I'm sorry to hear that. This remains a mystery to me, as the plugin's worked fine on all of the WP 2.7+ installations I've tried it on so far – I'll keep trying, though.

  19. Posted March 31, 2009 at 10:43 am | Permalink

    Hi everyone – I've found a problem that may be the cause of the issues people have been having. Try version 0.5, see if it works for you.

  20. Posted March 31, 2009 at 12:06 pm | Permalink

    I just uploaded the new version of the plugin, and I get the same problem – the "page not found" screen generated by my server. Would you be willing to check out my site and see if you can find out why? I'd be happy to pay for your time… I'm really liking the idea of this plugin, and it would make my day to have it work! Thanks.

  21. Posted April 17, 2009 at 9:47 am | Permalink

    Hey guys if you are having problems with WordPress 2.7.1 then do the following:

    1. Go to the permalinks page by clicking on "Permalinks" which is under settings tab on the left side.

    2. select "Custom Structure" and next to it type in "/index.php" (without quotes)

    3. Click Save Changes

    Done.

    btw you cannot put _ or ( or ) etc in ur custom permalinks while your making a post or page.

  22. Posted April 21, 2009 at 1:41 pm | Permalink

    Hi I'm trying to use this plugin (0.5.1) on a development site (WP 2.7.1) and my permalink structure is: /%category%/%postname%/

    When I clicked on a category (eg: beginners), it used to be http://blah/category/beginners

    I wanted to use this plugin so it would just be http://blah/beginners

    It works for the category heading, but when I click on an article within that category, eg: http://blah/beginners/this-beginner-article I get a 404.

    Any idea of the problem?

    Cheers

    • Posted April 21, 2009 at 3:20 pm | Permalink

      Hi, Mike,

      I'm not sure I understand your original problem – if you've got a permalink structure as /%category%/%postname%, then where does the literal "category" part come from (as in /category/%category%/%postname%)? If I do it on my development installation of WP 2.7.1, all my categories show up at the root (eg. http://wordpress/uncategorized), and the posts within show up as http://wordpress/uncategorized/test-post.

      Also, I can't seem to replicate your problem – if I use the above permalink structure, then apply a custom permalink to a category, load that category page, then try to click on an article within the category, it loads fine (although it loads with the original category slug, not the custom permalink, as the base – this is expected behaviour, as the alternative isn't supported in CP)

      Perhaps if you make available a screenshot/complete summary of your permalink settings, as well as the settings for the category in question?

  23. Posted May 25, 2010 at 5:18 pm | Permalink

    Nice work!

    I have a suggestion.

    if the plugin can hook the ‘Change Permalink’ button under the title in post-edit page. just like the ‘edit’ button in page-edit view.

    • Posted May 29, 2010 at 2:35 pm | Permalink

      Cheers, Charlie! I’ll look into it for future versions

  24. Posted May 31, 2010 at 12:56 am | Permalink

    hi.

    i installed this plugin and set up my own permalink to one of my posts for testing. but there is always an error. :( can you tell my what is wrong? i am using wordpress 2.9.1.

    example. new permalink: http://fmdb.cc/followthewhiterabbit/selftitled/ old permalink: http://fmdb.cc/?p=976

    cheers. steven

    • Posted May 31, 2010 at 11:47 am | Permalink

      Hi Steven,

      Because you’re using the default ?p=… permalinks, your site hasn’t been set up for ‘URL rewriting’. So, I recommend you either use ‘pretty permalinks’ (just change it to one of the other options), or manually add in the requisite settings to .htaccess in your web root:

      <IfModule mod_rewrite.c>
      RewriteEngine On
      RewriteBase /
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule . /index.php [L]
      </IfModule>

      • Posted May 31, 2010 at 3:38 pm | Permalink

        Ah, thx for this! :) I added the code manually to htaccess and changed the permalink-structure in wp-options for testing. It works!

        But my custom permalink is still not working but the error is new. (http://fmdb.cc/followthewhiterabbit/selftitled/) Do you know what could be wrong?

        Cheers! Steven.

        • Posted May 31, 2010 at 3:58 pm | Permalink

          The site is redirecting from the URL with a slash on the end, to one without; Try changing your custom permalink to have a slash (if it doesn’t already), or not have a slash (if it has one)

          • Posted August 15, 2010 at 4:48 pm | Permalink

            Hi Michael!

            in the next days my blog will get a new design and will be updated to WP3. In this upadates i want to change the custom permalinks, too.

            old custom permalink http://fmdb.cc/release/-post-

            new custom permalink http://fmdb.cc/music/-post-

            So i want you to ask if you know a variant to forward adress of the old custom link automatically to the new custom link? So if sb have the old link, he will go the the new one.

            Best regards, Steven

          • Posted August 15, 2010 at 7:11 pm | Permalink

            Hi Steven,

            I think if it were me, I’d be using a .htaccess-based redirect.

            Something like

            Redirect 302 /release http://fmdb.cc/music/

            Should do the trick. I can never remember what we’re meant to do with trailing slashes, so if it doesn’t work as planned, try adding/removing them to either the “/release” part and/or the “http://fmdb.cc/music/” part.

  25. Posted May 31, 2010 at 10:13 pm | Permalink

    The new update is breaking the posts with custom permalinks. They all time out :(

    • Posted May 31, 2010 at 10:53 pm | Permalink

      I’m sorry to hear that! Can you post a URL demonstrating the problem?

      • Posted May 31, 2010 at 11:57 pm | Permalink

        Ah, I see. This is something I’ll try to fix in the next version, but for now, the problem’s the same for Stvn above: You’re getting a continuous redirect between the ending slash version, and the version without the slash. Try adding a slash to the end of the permalink

        • Posted June 1, 2010 at 12:55 am | Permalink

          Adding or removing a trailing slash basically means changing the URL from a SEO point of view which will have a negative impact on the current rankings in the SERPs.

          Are you planning to fix this anytime soon?

          Thanks

  26. Craig
    Posted June 1, 2010 at 11:17 am | Permalink

    Hi,

    when i set up Custom permalink that ends with a forward slash i get an 301 redirect loop.

    so if is set up a custom permalink like this http://www.domain.com/dir/url/ and go to it in the browser the loop looks like this

    dir/url/ –> 301 redirect dir/url –> 301 redirect dir/url/ –> 301 redirect dir/url –> 301 redirect etc..

    if i set up the custom permalink with out the slash on the end it works fine.

    How can i get it to work with the slash?

    I am currently using version 0.5.2 as it works with the forward slash on the end.

    Thanks

  27. Posted June 1, 2010 at 1:46 pm | Permalink

    To those having issues with redirection loops: Version 0.6 fixes this – ready in the next few minutes

  28. Posted June 1, 2010 at 3:29 pm | Permalink

    0.6 version doesn’t work – redirect problem always. 0.5 worked perfectly.

    how that can be?

    2.92 wordpress version.

    where can i download 0.5 vrsion?

  29. Posted June 1, 2010 at 7:35 pm | Permalink

    Nope =( Same trouble

    http://buket.io/blog/wedding_banquet

    loop….loop…loop…loop…

  30. Antares19
    Posted June 6, 2010 at 3:01 pm | Permalink

    Thanks for great plugin! :)

    There is one problem with it – page preview is not working on pages that have custom permalinks.

    It goes to url like: http://example.com/contacts/?preview=true&preview_id=235&preview_nonce=aa28f04

    (where “contacts/” is permalink) and says that i don’t have access to view drafts.

    • Posted June 6, 2010 at 4:29 pm | Permalink

      Cheers!

      A question – is that for draft page/posts, or published ones?