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.
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
- Unzip the package, and upload ‘custom-permalinks’ to the ‘/wp-content/plugins/’ directory
- Activate the plugin through the ‘Plugins’ menu in WordPress
- 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>
History
Version 0.6.1: Fix bug causing incorrect link from “View Post”/”View Page” button in post/page editor
Version 0.6: Fix infinite redirect for permalinks ending in a / (critical fix), and moved post/page permalinks settings to top of edit form, replacing prior permalink display
Version 0.5.3: Fix for invalid URL redirect (eg. http://domain.comfolder/file.html instead of http://domain.com/folder/file.html) when using permalinks without a trailing slash (like …/%postname%.html)
Version 0.5.2: Bugfix for matching posts when there are multiple posts that match parts of the query
Version 0.5.1: Compatibility fix for WP 2.7′s tag/category pages
Version 0.5: Support for installations in subdirectories (i.e. not located at the webroot). This should make Custom Permalinks start working for many people.
Version 0.4.1: WP 2.7 compatability fixes; fix for bug encountered when publishing a draft, or reverting to draft status, and fix for placeholder permalink value for pages
Version 0.4: Added support for pages, and fixed a bug concerning post drafts.
Version 0.3: Largely rewritten to provide more robust handling of trailing slashes, proper support for trailing URL components (eg. paging)
Version 0.2: Added management page to display all custom permalinks, with an option to revert selected items
Version 0.1.1: Fixed problem with categories
Version 0.1: Initial release
Related posts
- Taking the 404 further Update: I have now written a WordPress plugin that does...
- Smart 404 for WordPress Save visitors to your Wordpress site from unhelpful 404 errors!...
- Private Tags WordPress Plugin The “Private Tags” WordPress plugin allows users to specify a...
- Upload Janitor WordPress Plugin Clean up unused images and other files from your uploads...
130 Comments
Hello…nice plugin. Unfortunately I can’t get it to work. When I create tag and then edit a page post, type in the custom permalink, and then try to visit the page the page doesn’t come up. The link is correct, but the page is not found.
I have WordPress 2.9.2 and the latest version of the plugin.
Any ideas?
Thanks
Hi William – I’ve just added your answer to a new ‘FAQ’ section above. Does that address your problem?
I’ve been trying to research this issue to customize my permalinks. I’m getting the same error message. I’ve looked up about the .htaccess edit, but I can’t get it to work. I followed a tutorial where it said to create a text file and save it as htaccess.txt and then include the code that you mentioned:
RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L]
Then following the tutorial, I uploaded this into my “www” folder and then renamed the file to .htaccess which makes it disappear. Then my entire site went down. I had to ask tech support to bring it back up. Is there another easier way to update or add the .htaccess file?
Hi David – Best ask your web host support for this one, or, in a bind, the WordPress support forums. It may depend on your web host’s setup.
Great plug-in, thanks very much. Seems like something that should be included in WP options, so thanks for solving my problem! I’ve rated it 5 stars on the WordPress site and “works” with the 2.9.2 and 0.6 version combination. Again, thanks.
Greg
Cheers, Greg! That’s great!
For those having problems and getting a 404 error, make sure the .htaccess file as permissions of 666, so that it can be written to. This fixed the issue for me. Hope it helps :)
wordpress 2.9.2 custom permalinks 0.6
I’m a bit stumped. Maybe I did something wrong. When I create a page and create a custom link, for some reason its creating another page from the homepage where the slideshow images aren’t working…. what did I do? I created a sample problem page called Test Page. Here’s the link:
http://davidchanportfolio.com/blog/testpage
So the custom link works here! Woo! But what did I do wrong? Why is it displaying the homepage like that? I must’ve missed something…..
你的插件相当强大,感谢分享 ^_&
Excellent plugin – thanks for releasing it! I was able to keep my internal page structure with sub-pages for easy menu generation, but define a more SEO-friendly URL structure for the site I am currently working on.
5 stars from me – thanks again!
Great to hear, Elliot – Glad to help =)
Cheers!
This is a great plugin.. I just noticed something though. We just updated to WordPress 3.0 and there is a bug with the “View Page” button when editing a page inside the dashboard.
It returns this when there isn’t a custom permalink defined “http://domainname.com/parent-page/%pagename%/”
The error would be “%pagename%/”
Thanks for letting me know, Derrick! 0.6.1 should fix this
I just updated the custom permalinks plugin to version 0.6.1. My latest post is now giving a 404 error when I try to click on the permalink from the index as well as from category pages.
You can see the latest post on my main page http://theviolent.net/ The permalink is defined as http://theviolent.net/ps-others/dandelion.
If I try to remove the custom permalink by leaving the field blank, and have wordpress define the permalink, I still get the 404 error.
Hi Christopher,
Sorry to hear that! Hmm, all those links seem to be working for me (although it’s odd that both ps-others/dandelion and ps-others/electric-dandelion work).
Does 0.6 work?
Yeah, it was a really strange thing. My first post was called Dandelion. And no matter what permalink I put in, I received a 404. I deleted the post and then added a new post with a different name call Electric Dandelion, and it worked. I couldn’t for the life of me find what was causing the 404 from the first post.
I cannot figure out where to put the .htaccess file? I have serveral website running on my server. Do I put it in the /var/www/html/website1/ ? I put it there and it still does not work. I get the 404 error.
Hi Jeff,
The .htaccess file goes in your webroot. If it’s not working, I’d contact your web host’s support.
I am having a conflict with another plugin which needs to rewrite urls to work. I tried to explain the problem in a comment, but it kept saying it was spammy. So I opened a post on the word press forums explaining the problem.
If you have any ideas on the work around, please let me know. http://wordpress.org/support/topic/413522?replies=1
Thanks for your help.
Hi Michael, Not sure if this was answered already, but does your plugin support adding file extensions (i.e. .php) ?
~ Matthew
Absolutely
Also, the site I am trying to use this on: http://www.online-health-insurance.com/articles/2008/04/
Is using a custom.conf file to handle server-side redirects, so there is no .htaccess, but the custom permalinks are working.
On the link above, you can see two pages I am trying to use your custom permalink plugin on, but I get a 404 error.
Thanks, Matthew
nevermind, our admin had a different rule in the custom.conf that was intercepting the file because of the .php extension.
Hello Michael,
This is an excellent, but I do have one question. I don’t like typing the permalinks for the pages/posts, as I like the default permalinks and would like to keep it so wordpress does it automatically. Is there any way for me to disable this plugin only for posts/pages? I’m mainly using this for only categories.
Thanks, Jordan.
Hi Jordan,
Unless there’s something going wrong with the installation, as long as you don’t specifically provide a custom permalink for a post/page/category/tag, the default will be used. Is there something not working properly?
Great! Didn’t realize that! I’ve tried numerous custom permalink plugins and this is the only one that actually works and does what I need. Thanks for a great plugin! 5 stars!
Actually from what I’ve seen in using the plugin, if a category has a custom permalink assigned and a post in that category does not, it will produce a 404 error for that post.
Cheers, Jordan =)
Actually, this plugin isn’t designed to take the place of WP permalinks, for which you can define a pre-set structure. In Custom Permalinks, a category tag doesn’t affect anything else (like the posts that have that category).
If you want the site organised by category, you just need to use the built-in permalink preferences to do so; set your permalink to %category%/%postname%/ for instance.
If you’ve already got that structure set up, and you assign a custom permalink to the category, it’s actually not going to change the permalinks of the posts underneath the category – the way the WP permalinks system works, the %category% placeholder refers to the category’s slug, and not its physical URL.
If there’s enough demand, I may be able to find a way around that limitation, but there hasn’t been so far =)
I appologize, I didn’t quite follow what you were saying. My wordpress permalink structure is defined as you said “%category%/%postname%” But I use your custom permalink to remove the child-category nesting from the url.
For example I have a category called grunge. The wordpress permalink defines it as root/art/photoshop/grunge. I use the custom permalink to define it as root/grunge.
If I forget to add a custom permalink definition on a new post in the grunge category, the post takes on the wordpress default permalink, but generates a 404 error. Any time I forget to define the custom permalink for any new post, it defaults to the wordpress structure, but always generates a 404 until I go back and define the custom permalink.
Ah yes; so this occurs because of the way WP’s permalinks are implemented, where %category% refers to the slug of the category, and not its physical URL (which Custom Permalinks can change).
I may have a look at this one day, see if there’s any sensible way to work around it, but for now, I guess keep doing what you’re doing =)
It only happens when I am dumb and forget to define the custom permalink. But it was the reason I asked once about the possibility of post inheritance where the post inherits the custom permalink structure of the category.
For example: all new grunge posts would by default have the custom permalink root/grunge/newpostname
Any chance this plugin would make 404 requesetsredirect to index.html or home?
Nope, but you could probably do that by adding
<?php header("Location: /"); ?>to 404.php in your template.Another suggestion: ignore uppercase and lowercase.
Hi Michael.
Thanks for this nice plugin. I have some posts published under the category “cat1″ an the permalinks like this: /%category%/%postname%/. I edited the cat1 permalink to appear like “supercategory/”. So my question is: Is there a way to make the posts under cat1 to have a permalink like: supercategory/%postname%/ instead of cat1/%postname%/ automatically?
Thanks for your support.
Cheers Hernan! I’m afraid not, at least not yet – you’ll need to set the permalinks manually. I may do this at a later stage, though.
We have converted over a website from asp to WordPress and are using the custom permalinks plugin to keep google happy. After the migration we started seeing a massive amount of 404 errors on google wmt’s. Some of the links look like this: http://www.mesotheliomahelp.net/>Mesothelioma, Asbestos Cancer, Mesothelioma</mesothelioma-doctors-AK.asp and obviously do not link back to correct pages. We have run link checkers as well as Xenu and cannot find out where google is getting these errors. I have to admit we are stumped. Do you have any clue where we might look?
No idea I’m afraid, JR
Michael,
Thanks for looking. I submitted a modification to the sillybean html import tool for WP that integrates with your CP plugin. I have a copy if anyone is interested. It works great for importing a whole site of html(or other) and keepin the links the same. I think Steph ay Sillybean is going to integrate it into her next release. Thanks for the great tool.
JR
Hi Michael. Great plug-in… I’d have it in my host without any problem, but now I need to use it in a web host wihtout mod_rewrite on. Is there any way? Thanks, for your time. Cuyo
I’m afraid not, Cuyo – it’s mod_rewrite only
thanks for your quick response. It is a pity that can not be used without mod-rewrite, but it is logical …. mmmmm … do you know any plug-in to do the same (custom url 100%) without mod-rewrite?
Actually, it just occurred to me that there’s something you could test – Try setting the permalinks as being prefixed by a “?” – like, “?my-custom-permalink”. It may actually work…