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. Posted October 22, 2010 at 7:37 am | Permalink

    hey… i am looking for a solution to an old website without loosing its pagerank he has pages that look like name.htm that exist for 9 years

    i have installed your plugin (10x grea plugin :)) and run some 301 checks on the resulting address but it returns as if the checkers doesnt recognise any 301 happening

    if i create this pages on wordpress for the first time on a new installation and fill he’s content PLUS using your plugin to create the right (old website) addresses and the page title is different ftom the URL

    does it stil count as 301 redirect ?? (asking cuz’ such a case would result in pagerank lost)

    hope to here from you Cheers, sagive

    • Posted October 22, 2010 at 2:11 pm | Permalink

      Hi, Sagive,

      No, it doesn’t count as a redirect: The custom permalink becomes the actual address, so it just returns a 200 status. That shouldn’t result in any PR loss, because nothing will have changed (unless I’m missing something).

      If you want different URLs, you may want to take a peek at Smart 404, too, which does do 301 redirects from the old to the new location.

      Cheers, Michael

      • Posted October 25, 2010 at 1:19 pm | Permalink

        Thats gr8!! that solves a lot of problems relocating exsisting website to wordpress :)

        “me like”

        Cheers, sagive

  2. Posted October 29, 2010 at 1:51 pm | Permalink

    I’ve been told that my host company do not support .htaccess files. I was told to create a ‘rewrite.script’ in much the same way as you describe creating the .htaccess. I have put this in the web root folder and the plugin still doesn’t work. Any thoughts?

    • Posted October 29, 2010 at 2:39 pm | Permalink

      No idea, Mike – you’ll have to ask your host

  3. Posted October 31, 2010 at 3:28 pm | Permalink

    Hi Michael,

    I greatly thank’s for your custom permalink plugin, I have used it alot on my blogs. but I have troubled with one of my blog that using your plugin. when I change my permalink to /weblinks.php?cat_id=1&weblink_id=3

    I got error on 404 page.

    Can you please take look what’s the problems,

    Thank’s

    Hari

    • Posted October 31, 2010 at 3:49 pm | Permalink

      Hi Hari,

      Permalinks should be straight paths, without query parameters – the example you gave won’t work, because it has a query part.

      • Posted October 31, 2010 at 4:03 pm | Permalink

        Thank’s for your fast replied, Can I ask you another suggestion for my problems.

        • Posted October 31, 2010 at 4:49 pm | Permalink

          As far as I know, there’s no easy solution, if that’s the permalink format you want. Ask on the WP forums, if you like, but I think you’d need to write some code to make it work.

  4. The NU
    Posted November 4, 2010 at 4:59 pm | Permalink

    Hello, this is a great plugin but it just doesn’t seem to do what I need nor what I thought it did. I thought it would allow me to have any type of url set up as I wish. I’m in the process of moving my site to a new host and not just moving host but switching to a full wordpress setup. As such I like to keep my pages the same.

    I have a really simple set up. It looks normal, such as I have /features/ then /features/page.html, etc. I can’t however do this, my blog was installed and I defaulted the Permalink settings to Month and name, as you state the issue with this. Well, is there a way to turn this plugin off for only working on pages?

    I don’t really need this for blog post being I’m find with the common set up. In fact I was going with something more like /cat/post.html for my needs with handling blog post and moving all my pages over to wordpress pages with my default set up I have right now so I don’t lost page rank or have to deal with filling the server with annoying 404s.

    Well, if I set my custom permalink in the standard wordpress settings, any page I set with a / goes into a endless loop and times out. Pages that end in .html work just fine. If I remove my settings and go to say Month and name all my pages that end in a / work but now my pages with .html loop.

    I tried to just not have a / at the end of the standard settings something like /%year%/%monthnum%/%postname% but what happens is anything with a / now gets removed and goes to just /features which is a different url an any page with .html gives me a wordpress 404 page not found error.

    Is there any way to fix this? I was search high and low on ways to make wordpress not look so wordpress link in terms of how I customize the urls, I thought this plugin was going to do the trick but it appears to have limits and a bit misleading, it seems you can’t have one page be .html another end with a / and another be say .php being only one will work base on whatever you have set in the standard permalink settings of wordpress.

    Setting it at Default which is the ugly ?p=223 way breaks everything being it tires to add a / to the end of everything now. I’m stuck and can’t find a way around something that should be simple.

    I’m using the latest version of WordPress and the plugin and even tried to downgrade to see if it works. It seems to be linked to whatever is set in the standard permalink settings. I’m not sure if this was met to work or not.

    Basically I want to be able to have all my blog post be something like /cat/postname.html and my pages be a mix of ending in a slash or ending in .html. It doesn’t seem to work and no matter what I have to have one or the other one everything. This simply wont work for my site as I’ll lose links and will cause a lot of 404 errors if I just setting with one or the other.

  5. Posted November 5, 2010 at 4:03 pm | Permalink

    Hi Michael, First of all I think what you’ve created is really great. I haven’t been using wordpress for that long and I’m already exited about the possibilities due to your plugin. However, there is one issue I’m having that I saw someone else wrote something similar to you about but I wasn’t clear on the solution.

    I do not have WordPress installed in my root directory, but rather a sub-directory which I will call /subdir/ for the purpose of this discussion. When I have the url structure set to default, requests to everything on the WordPress blog (under /subdir/) seems to work fine…but when I change the url structure to be /%postname%/%post_id%/…everything works fine EXCEPT for the “index” page of the blog….which in this case is domain.com/subdir/….

    It just loops infinitely as follows: when I request: – http://www.domain.com/subdir it redirects for a while and ends at: – http://www.domain.com/subdir/ with the error message: – The webpage at http://www.domain.com/subdir/ has resulted in too many redirects

    when I request: – http://www.domain.com/subdir/

    it redirects for a while and ends at: – http://www.domain.com/subdir with the error message: – The webpage at http://www.domain.com/subdir has resulted in too many redirects

    It only happens with this page…any ideas on what I can do to fix this? If you need to see my blog it is at: atlanta seo company

  6. abdullah
    Posted November 11, 2010 at 5:54 am | Permalink

    Hai Michael,

    I am trying to do custom permalink in my localhost,i am getting following error message

    Redirect Loop

    Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

    The browser has stopped trying to retrieve the requested item. The site is redirecting the request in a way that will never complete.

    * Have you disabled or blocked cookies required by this site?
    * NOTE: If accepting the site's cookies does not resolve the problem, it is likely a server configuration issue and not your computer.
    

    Please help me what exactly missing ?

    • abdullah
      Posted November 16, 2010 at 5:23 am | Permalink

      Is custom permalink work in subdomain ? like http://www.example.com/test.

                Plesae help me if anyone know.
      

      • avahaf
        Posted November 17, 2010 at 7:41 am | Permalink

        hay,

        I test custom permalink with subfolder.It wont work it will give redirect loop error.While its working fine in main folder.

        • globalpio
          Posted December 5, 2010 at 5:46 pm | Permalink

          Thanks for the excellent plugin….

          Is custom permalink work in subdomain ? like http://www.example.com/test. I have the same problem… When I use the custom permalinks from WP the redirect works fine However when I use your (excellent) plugin then it will not work in this subdirectory.

          Any suggesitons?

          • Posted December 5, 2010 at 5:51 pm | Permalink

            That’s tricky, I’m not sure why it’s not working for you! I’m using Custom Permalinks on this blog (in fact, this post has a custom permalink), and this blog is running in a subdirectory (“/blog”) just fine.

          • rob
            Posted December 6, 2010 at 12:07 pm | Permalink

            For those, like me, who got frustrated with the indefinate loops on permalinks.. i now have it resolved It seemed that adding a / at the end of the custom defined name, then the link worked

            http://www.metamedicine.com/products/hsp/affiliates/ so the custom link is defined as ==> affiliates/

  7. globalpio
    Posted December 5, 2010 at 5:58 pm | Permalink

    thanks for you quick answer…

    http://www.metamedicine.com/products/hsp/affiliates/ (not a custom, but a regular wp redirect)

    http://www.metamedicine.com/products/hsp/privacy ( a custom redirect, never ends)

    htaccess:

    BEGIN WordPress

    RewriteEngine On RewriteBase /products/hsp/ RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /products/hsp/index.php [L]

    END WordPress

    Any suggestions?

  8. Hays
    Posted December 13, 2010 at 3:41 am | Permalink

    any chance that you can get this plug-in to run with WP 3.0? The URL’s are being corrected but when I try to access the pages they never show up.

    • avahaf
      Posted December 13, 2010 at 4:57 am | Permalink

      Hai Hays, It works with WP 3.0 I am using it.Please check the custom permalink plugin version

  9. Posted January 13, 2011 at 4:09 pm | Permalink

    Hi Michael,

    Great plugin and has been working fine for me for months until today. I don’t think I changed anything but my links no longer work and I get the “Not Found – The requested URL…..”

    Any help would be greatly appreciated.

  10. Andy Krier
    Posted January 18, 2011 at 6:22 pm | Permalink

    This plugin looks like it’s exactly what I need, but it doesn’t seem to work with 3.xx. Any plans to add support? I may be able to help fund development.

  11. Andy Krier
    Posted January 18, 2011 at 6:27 pm | Permalink

    Please delete/ignore my last message. I must have been smoking crack. Plugin works great. You are awesome.

  12. Posted January 19, 2011 at 8:20 pm | Permalink

    Have you noticed any conflicts with your plugin and the “page revisions” feature in the newer versions of wordpress?

    We recently upgraded a site to wordpress 3.0.4 from 3.0 and it caused many pages with a custom permalink set to serve a 404 page error. The only solution we could find was deleting the pages completely and reentering them, which was cumbersome on a large site.

    It appears that it was only effecting pages with too many “auto revisions” saved.

    I would appreciate any thoughts or feedback you have on the matter.

    Thanks!

  13. x10
    Posted January 20, 2011 at 6:27 am | Permalink

    Thanks for your FAQ, it had just the answer I needed. :)

  14. Nathan
    Posted January 24, 2011 at 6:03 am | Permalink

    This is a great plugin, many thanks for providing it for public use.

    Question: does this work with custom taxonomies? I have a taxonomy set up, and upon activating the plugin, I can see the Custom Permalink field when I click the taxonomy term to edit it. However, when I enter a URL and click “Save”, and then return to the edit screen for that term, it’s blank again. So it looks like the plugin is not saving the value, or else it’s not able to tie the value to the custom taxonomy?

    • Dave
      Posted February 15, 2011 at 9:43 pm | Permalink

      I’ve had the same experience, Nathan – Michael, do you have any plans to update this plugin to work with custom taxonomies?

  15. Andy Krier
    Posted February 3, 2011 at 11:32 pm | Permalink

    I’m having trouble installing the “All in one SEO”and “Contact Form 7 to Database Extension” plugin while I have your plugin installed. Any clues? I already tried adding and removing slashes as you mentioned above, but to no avail. Any help would be greatly appreciated.

  16. Posted February 9, 2011 at 7:20 am | Permalink

    Recent custom permalinks plugin does not feature the extension of the page, I could see the plugin only able to provide a text field next to the website URL, everytime we need to type the extensions i mean .html, will that change in the next update.

  17. Neo
    Posted February 22, 2011 at 8:03 pm | Permalink

    Hi Michael,

    I’ve recently installed custom permalinks and the plugin works great, except for some small issues. The Tools -> Custom Permalinks page has links to page.php instead of post.php – is there a newer version of this plugin available somewhere? Also, the plugin works with multisite, only if the permalink structure is “ugly”. Otherwise I either get a 404 or infinite redirect loop (f.e. from custompage.htm to custompage.htm/ and back). Was this plugin well tested on multisites?

    Any help would be appreciated :)

    • Posted February 22, 2011 at 8:30 pm | Permalink

      Hey Neo,

      I’m afraid the plugin is a little antiquated – it works fine on many setups (including mine, which is probably why it’s not been updated a great deal yet!), but I will certainly concede it isn’t the most robust, and definitely hasn’t been tested on multisites, I’m afraid!

  18. Posted February 23, 2011 at 12:46 am | Permalink

    @Michael – First, thanks for developing this in the first place. Saved me loads of time today for a client project I had to put together. Second, in regards to the problem Neo was seeing (infinite redirect loop between / and no /), the fix isn’t too terrible:

    At line 208, add: add_filter('redirect_canonical', 'custom_permalinks_abort_canonical');

    then, somewhere else (I put it at 243), add this simple function: function custom_permalinks_abort_canonical(){ return false; }

    Hope that helps. Thanks again for the plugin Michael!

    • Neo
      Posted February 23, 2011 at 9:20 pm | Permalink

      Hi Peter,

      Your suggestion works :) However, after linkchecking i noticed that some pages are 404. After a detailed examination I found something interesting.

      Create a new page, with some special symbol in title (in my case it was trademark symbol ™). WordPress will url-escape it, so you can enter an url, like http://localhost/somepage™/ . If you create a custom permalink for this page, it will not work (just gives 404).

      Is this a bug?

  19. Posted February 23, 2011 at 9:37 pm | Permalink

    I have had the same problem with using special characters in the titles and getting 404 page errors. It appears to only impact versions 3.04 and up… When I reverted back to 3.01 it fixed the problem.

    • Neo
      Posted February 25, 2011 at 7:20 pm | Permalink

      Hello BPIZZY,

      Unfortunately your solution does not work. I installed a clean copy of 3.0.1 to test this. Pages with special characters render 404. You might want to double check your website.

      Reverting back to 3.0.1 was not really an option for me anyway due to plugins and security, so i found a bugfix ( sort of :) )

      I changed line 217, from: $_SERVER[‘REQUEST_URI’] = $_SERVER[‘PATH_INFO’] = ‘/’.ltrim($originalUrl,’/’); to $_SERVER[‘REQUEST_URI’] = $_SERVER[‘PATH_INFO’] = ‘/’.ltrim(urldecode($originalUrl),’/’);

      This, combined with Peter’s canonical redirect fix, works for our multisite setup, including pages with special chars.

      Thanks again everyone for your answers, and thank you Michael for developing this great plugin ;)

  20. Posted March 4, 2011 at 1:04 pm | Permalink

    Hi Michael

    Dig your plugin – having a slight issue with WP3.1 and Custom Permalinks.

    On Category Pages there are two custom_permalinks_form’s being shown and I am unable to make a custom permalink for any categories.

    Could really use some help here from anyone in this comment list – I am 50% sure it has to do with the new taxonomies being used

    A nice addition would be to have a custom permalink work with a subdomain. Ie, when linking to category.domain.com – have it show the page/post/archive of domain.com/category

    Thanks again

    B

    • Adam
      Posted May 2, 2011 at 5:25 am | Permalink

      +1 on this problem.

      I have been looking all over for ways to solve this (disable javascript, upload new .htaccess files into wp_admin, etc.).

      My debug.log is throwing these three errors every time I try to update a category-specific permalink:

      PHP Notice: Undefined property: stdClass::$term_id in /wp-content/plugins/custom-permalinks/custom-permalinks.php on line 358 PHP Notice: Undefined property: stdClass::$term_id in /wp-content/plugins/custom-permalinks/custom-permalinks.php on line 360 PHP Notice: Undefined variable: originalPermalink in /wp-content/plugins/custom-permalinks/custom-permalinks.php on line 366

      Any thoughts? I would really love to use this plug-in.

      Thanks so much, Adam

      • Posted May 22, 2011 at 9:20 am | Permalink

        I love this plugin, but am having the same issue with categories. Anybody manage to fix this??

        Cheers Christine

    • Posted May 30, 2011 at 4:11 pm | Permalink

      The problem here is a bug in WordPress 3.1.3, but it’s easily fixed.

      Open wp-admin/edit-tag-form.php, and find line 83, which looks like this:

         if ( 'link_category' == $taxonomy )
      

      Then add ‘else’ to the start:

         elseif ( 'link_category' == $taxonomy )
      

      That should do it.

  21. Lucy
    Posted April 12, 2011 at 10:26 am | Permalink

    This does exactly what I needed it to do! Thank you!

  22. Posted April 26, 2011 at 11:13 pm | Permalink

    Does this plugin handle ssl ok? On one of my sites I get a 404 when I try to view a post with https. My first thought is that the custom-permalink plugin is causing it. Any ideas?

  23. Posted April 27, 2011 at 9:06 pm | Permalink

    I found a bug in this plugin. https pages give a 404 because get_option(‘home’) ignores ssl. Replacing every instance of get_option(‘home’) with get_site_url() fixes the issue.

  24. ki11ua
    Posted May 3, 2011 at 7:43 am | Permalink

    Hello,

    I using different path for wordpress installation “WordPress address” and actual site path “Site address”. I’ve upgraded to woprdpress 3.1.2 and everything is fine But since upgrading from 0.7 release from 0.6.1 the Custom Permalink Field inside the post is forced to read “WordPress address” not the “Site address”. Is this a bug of the plugin? Is there a work around?

    Thank you

  25. Jason
    Posted May 4, 2011 at 5:11 pm | Permalink

    Yes I am having the same issue as ki11ua!

    Does anyone know a workaround until an update is posted?

    • Jason
      Posted May 4, 2011 at 5:43 pm | Permalink

      I just downgraded to the previous version to fix everything for now.

  26. Posted May 4, 2011 at 6:00 pm | Permalink

    Sorry about the delay, folks – I’ve just released 0.7.1 which should fix both the pre-3.0 compatibility problems, and the address problems.

  27. Posted May 10, 2011 at 4:52 am | Permalink

    Michael, your plugin looks like exactly what I need however once installed I cannot find the place where I can make the actual edits. You say in your installation notes that I should see a Custom Permalink field on each page or post(?) but I see nothing. I am using the Thesis theme – could that be a problem?

    • Posted May 10, 2011 at 11:06 am | Permalink

      Hi Don,

      If you open up the WordPress admin area (/wp-admin), then edit a post or a page, you should see a field just beneath the title labeled “Permalink”. You can type anything in there, and that’ll be the new permalink.

      Cheers, Michael

  28. Posted May 13, 2011 at 6:02 pm | Permalink

    Hi Michael,

    in WordPress 3.1.2. the paginated links of tag pages (/page/2/) are not working (while using Custom Permalinks 0.7.2.)

    Please take a look at the end of my site. Here’s an example: http://www.mojoba.de/blog/witzige-filme/

    Is there a work around?

    Thank you

  29. Posted May 28, 2011 at 4:47 pm | Permalink

    I posted a support request at http://wordpress.org/support/topic/custom-permalinks-07-links-broken-when-site-address-is-not-wp-address because I couldn’t find this place to check, but received no reply. Is the following problem now solved? Is it safe to update to 0.7.2?

    I tried to copy the problem here but it won’t take the links in it. How can we discuss problems in the Internet if we are not allowed to post links?

    • Posted May 30, 2011 at 12:33 pm | Permalink

      Hey Peter – I’ve replied on the forum. Yes, I’m afraid my spam filter sometimes doesn’t like large numbers of links – blame the spammers, not me, though – it’s that or I drown in viagra links =)

    • Posted May 30, 2011 at 12:34 pm | Permalink

      Oh, and yes – 0.7.2 is meant to address this problem.

      • Posted May 30, 2011 at 2:50 pm | Permalink

        Thank you, Michael. I have just upgraded to 0.7.2 and it seems to be working correctly for me, now with WP 3.1.3. Thank you for fixing the problem.

        • Posted May 30, 2011 at 3:32 pm | Permalink

          No problem, Peter. You should know, I’m just working on a bug Lucien reported above, that seems to clobber /page/# URLs in WP 3.1.3. Should have a fix soon.

  30. Posted May 30, 2011 at 3:48 pm | Permalink

    @Lucien: Okay, I’ve just released 0.7.3, which fixes the /page issue you mentioned. Cheers for the heads-up.