Plugin: WCS Custom Permalinks Hotfix

by on May 5, 2011

This plugin is a hotfix for permalink issues encountered with WordPress installations after upgrading to 3.1.x. It fixes the 404 error (or blank page) for menu/dropdown categories and tags. It fixes pagination for search results, categories, and tags. And, it fixes RSS feeds for categories and tags.

Further, because this hotfix is coded to work with internal URI structures, it should continue to resolve these issues in perpetuity … if needed. Also, it is worth noting that this “permalinks bug” is fairly common with both LAMP and IIS servers … after upgrading to WordPress 3.1+. Nonetheless, it is our hope that the alternatives listed below will repair the issue so that you don't need our plug-in.

You can download this plug-in at the WordPress repository. You may want to view the full source code explanation for the prototype of this plug-in (along with numerous user comments). Additionally, you may find this plugin-specific FAQ helpful.

If you find this plug-in useful or the tips below helpful, a small donation will support our continued WordPress development efforts. Enter any amount.

Leave questions, comments, and suggestions below. Thanks.

ALSO … Seán Byrne at SSD Freaks has done some painstaking research about this permalinks issue. His problem was caused by the Multi-page Toolkit plug-in after upgrading to WordPress 3.1. Moreover, his detailed article, Culprit Found, may well provide information useful to others.

Additional Usage Information
Before using this plug-in, be SURE that your issues are not caused by plug-ins that modify category links, tag links, and/or canonical redirects … by deactivating them. You may also want to enable them one-by-one to see if you have an issue with a specific plug-in.

Depending on your specific Web browser settings, you may need to:

  1. clear your browser's cache (Cache Clearing Tips for All Browsers)
  2. visit your home page
  3. refresh your browser (F5)
  4. and, then test your menus/dropdowns with categories and tags

IF you are ALSO using a BLOG CACHE plug-in, you should:

  1. activate this plug-in
  2. clear your entire blog cache (with that plug-in's admin panel)
  3. clear your browser's cache (Cache Clearing Tips for All Browsers)
  4. visit your home page
  5. refresh your browser twice (F5)
  6. and, then test your menus/dropdowns with categories and tags

Eventually, plug-in authors and WordPress will update their code. When you no longer need it, simply de-activate and/or remove this hotfix plug-in.

Theme Related Issue
Try switching to the default TwentyTen theme to make certain that your current theme itself isn't causing the problem.
Permalinks Update Issue
In all cases, setting your Permalinks structure (Dashboard -> Settings -> Permalinks) to the default setting corrects the bug. But, for many installations, being forced to utilize default permalinks in not a viable option.

Try this. Switch back and forth between the default permalink structure and a custom one … saving each time. Do this two or three times. Now, refresh your browser (F5) on your home page and see if your permalinks are working correctly.

flush_rules() Issue
The following PHP statement anywhere in code can break permalinks too. If you find it, comment it out.

Code: PHP (plus WordPress)flush_rules() Issue

$wp_rewrite->flush_rules();

Also, even if you're running a single-site installation, you can have “always on” plug-ins in the “mu-plugins” folder. See if that folder exists under “wp-content”. If so, temporarily rename the “must use plugin” folder.

Concentric/XO Communications Specific Issue
If your WordPress installation resides on a Concentric/XO Communications shared hosting platform, there is an additional issue with permalinks. In this case, you'll notice that category, tag, and pagination links work … but your home page times out on this specific server configuration. If you experience this issue, complete the hotfix by:

  1. open this plug-in's wcs-custom-permalinks-hotfix.php file
  2. scroll down to line #153 (// if everything works but your home page times out)
  3. follow the simple instruction to COMMENT line #151 and then UNcomment line #158
  4. save and close the file
  5. visit your home page
  6. refresh your browser twice (F5)
  7. all fixes including the home page should be working now
Media Temple Specific Issue
If your WordPress installation resides on the Media Temple hosting platform, there's a high probability that your .htaccess file is blank (or nearly empty). In this case, simply inserting the .htaccess code below may resolve the issue in your case.
.htaccess File
If your WordPress installation resides on a LAMP server (Linux, Apache, MySQL, PHP/Python/Perl), you should have a file named .htaccess in your root WordPress folder (the one that contains wp-config.php).

When saved manually, the .htaccess file should utilize unix-style line-feeds (\r) and not DOS-style line-feeds (\r\n). Also, servers with FontPage extensions, use a proprietary .htaccess file and should not be modified directly.

Also, note that direct manipulation of the .htaccess file should only be attempted by an experienced network administrator. Ergo, implement the following modifications with this caveat  in mind.

ALWAYS … backup your .htaccess file BEFORE making ANY changes!

.htaccess File Creation:

  1. this file is created/modified when you change your permalinks settings
    (Dashboard -> Settings -> Permalinks)
  2. by default, the access permission on this file is set to 644
  3. your server may not be able modify it as needed when you set custom permalinks
  4. temporarily CHMOD .htaccess to 777
  5. now switch back and forth between a default permalink structure and a custom permalink structure a couple of times … saving the change each time
  6. now, CHOMD .htaccess back to 644
  7. open .htaccess to verify that it contains a segment similar to one of the following

single-site baseline example to reconstruct .htaccess, if needed:

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

multi-site baseline example to reconstruct .htaccess, if needed:

# BEGIN WordPress Multi-Site
<IfModule mod_rewrite.c>

RewriteEngine On
RewriteBase /

#uploaded files
RewriteRule ^(.*/)?files/$ index.php [L]
RewriteCond %{REQUEST_URI} !.*wp-content/plugins.*
RewriteRule ^(.*/)?files/(.*) wp-includes/ms-files.php?file=$2 [L]

# add a trailing slash to /wp-admin
RewriteCond %{REQUEST_URI} ^.*/wp-admin$
RewriteRule ^(.+)$ $1/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule . - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-.*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]

</IfModule>
# END WordPress Multi-Site

 

Share This Article: “Plugin: WCS Custom Permalinks Hotfix”

(Also Available: Press CTRL+D to Bookmark this Page)

Comments

Share Your Thoughts  45 Responses to “Plugin: WCS Custom Permalinks Hotfix”
  1. 21
    Joseph says:

    Hello Luke,I have some problem in missing page in category, so I implemented your hotfix plugin in my worpress version 3.1.2..It works, but unfortunately the permalink on category has change to the default settin. However in other single and page post it uses my custom permalink which are right. Just in the category url that I am have this problem.Thanks

  2. 22
    Sander says:

    Hi, i’m dutch sorry for my englisch.The catagory and tag problem is fixt  , but the post now give a 404 Custom Structure: /%postname%/ = 404 on postif turn it back to Default (/?p=123) is works. So a new problem. and i need the /%postname%/  for my SEOThe sub-catagories have a problem to. the URL for a sub-catagory is:http://www.site.com/catagory/sub-catagory/catagory/sub-catagory/  /catagory/sub-catagory/  + /catagory/sub-catagory/  Any ideas?

  3. 23
    kkk says:

    thanks for your plugin but it doesnt work for meim using lighttpd and custom permalinks /%postname%/.. the problem i have is with search results..when i want to go to page2 of search results it goes to page 2 of main posts…ive tried deactivated plugin clearing cache but nothing…any other ideas? it only works with default permalinks

  4. 24
    Nigel says:

    We installed your plugin after the issue with the tag/category permalinks. It works fine EXCEPT for the following:oursite.com/wp-login.php gives up a 404. It is your plugin causing this issue because when it is deactivated this link works fine. Is there a work around. Permalinks in our htaccess is:# BEGIN WordPress<IfModule mod_rewrite.c>RewriteEngine OnRewriteBase /RewriteRule ^index\.php$ – [L]RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule . /index.php [L]</IfModule># END WordPressThx for any help – urgent!?

  5. 25
    Dennis says:

    I have the 404-issue and tried your plugin, and other solutions I found on the web, but nothing works. In the phperror.log I get this info:[23-Jun-2012 09:55:14] PHP Warning:  include(/home/d6649/public_html/wp-content/themes/Rojteatern/searhform.php): failed to open stream: No such file or directory in /home/d6649/public_html/wp-content/themes/Rojteatern/404.php on line 11[23-Jun-2012 09:55:14] PHP Warning:  include(/home/d6649/public_html/wp-content/themes/Rojteatern/searhform.php): failed to open stream: No such file or directory in /home/d6649/public_html/wp-content/themes/Rojteatern/404.php on line 11[23-Jun-2012 09:55:14] PHP Warning:  include(): Failed opening ‘/home/d6649/public_html/wp-content/themes/Rojteatern/searhform.php’ for inclusion (include_path=’.:/usr/local/lib/php’) in /home/d6649/public_html/wp-content/themes/Rojteatern/404.php on line 11

  6. 26
Page 2 of 2«12

Trackbacks

Check out what others are saying about this post...
  1. [...] WCS Custom Permalinks Hotfix is a hotfix for permalink issues encountered with WordPress installations after upgrading to 3.1.x. [...]

  2. [...] WCS Custom Permalinks Hotfix is a hotfix for permalink issues encountered with WordPress installations after upgrading to 3.1.x. [...]

  3. [...] WCS Custom Permalinks Hotfix is a hotfix for permalink issues encountered with WordPress installations after upgrading to 3.1.x. [...]

  4. [...] WCS Custom Permalinks Hotfix is a hotfix for permalink issues encountered with WordPress installations after upgrading to 3.1.x. [...]

  5. [...] 不停 Google search 下發現原真係 WordPress 既問題,而且仲有人已經出左個 Plugin 形式既 hotfix ! [...]



Share Your Thoughts

(Some editor features are restricted unless you're logged in.)

(When replying to a specific comment, your browser may require Shift+Enter instead of just Enter.)


(get a gravatar)


Notify me of followup comments via e-mail. You can also subscribe without commenting.