Alister Cameron // Blogologist

Changing the world. One blog(ger) at a time.

Two WordPress plugins you don’t need and shouldn’t use

I immediately want to apologise to the authors of these plugins but the fact remains, sometimes someone comes along offering to kill a flea with an elephant gun, and well… it’s time to just come right out and admit that was the wrong approach.

The two offending plugins on my hitlist for today are the Permalink Redirect plugin, which Ronald Heft (cavemonkey) and others have listed as a Top Ten WordPress plugin, and the no-www plugin, by no less a luminary than Matt himself (aw crap can you get away with contradicting da man?!).

Both these plugins do with an elephant gun what Apache can do with a pea-shooter. Yep… I’m speaking again of mod_rewrite and a .htaccess file. My point is simple enough… use the right technology for the right problem; always keep things as simple as possible.

A quick and obvious point: if you can’t use mod_rewrite because your host doesn’t turn that on in Apache… get another host. If you’re on IIS you can get a host to achieve something similar with an ISAPI filter (that’s really pretty cool, and one I’ve stress tested under load and checks out OK), but it’s fair enough that many Windows Server hosts will need some convincing to install that. But… if you’re genuinely left in this “can’t use mod_rewrite camp” then I guess the plugins are fair enough. What else can you do?!

But now for the rest of us…

I’ve already posted about how to use mod_rewrite to forcibly include or exclude a www in your domain (URL). You’ll notice on my site that if you remove the www, it gets stuck back on. So we’ll move on.

And the other plugin? Cavemonkey is absolutely right in explaining the importance of the function of this plugin:

One of the fatal flaws of WordPress is that URLs with a trailing slash are the same as URLs without. This is bad for your stats since one page can show up under multiple URLs, and it’s also bad for search engines who may duplicate your pages in their results.

No arguments there. Just a question of how it’s done. Here are the two lines to add to your .htaccess file to achieve the same thing in a far simpler, lightweight kind of way:

RewriteCond %{REQUEST_URI} ^/[^.]+[^/]$
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1/ [R=301,L]

I add this mod_rewrite rule under the one that deals with the “www” and together they sit above the standard WordPress rules, and look like this:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.alistercameron.com$ [NC]
RewriteRule ^(.*)$ http://www.alistercameron.com/$1 [R=301,L]

RewriteCond %{REQUEST_URI} ^/[^.]+[^/]$
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1/ [R=301,L]
</IfModule>

It’s not rocket science, and it does assume you can edit a file via FTP, but that’s all there is to it.

If you get something wrong, yes, mod_rewrite can kill your site in one fell swoop, but if you quickly restore the earlier version of the file and check your changes you’ll be fine.

Don’t you feel so much better now? We’ll leave the elephant gun for another day… After all, it was just a couple of fleas icon smile Two Wordpress plugins you <i>dont</i> need and <i>shouldnt</i> use

mod_rewrite, htaccess, wordpress, plugin, wordpress plugin, redirect, isapi, url rewrite

21 Comments

Note: Commenter website links are not no-followed, in case
you were wondering... I believe in rewarding commenters!

  1. Posted 7 years, 9 months ago // Permalink

    Here is a challenge for you

    I am not a .htaccess guru, but after reading the thread over at Aaron Wall’s blog recently, and especially the comments, I decided it must be possible in some way to create a universal .htaccess file that I could upload to 50+ blogs and for it to work immediately.

    Is there a reason http_host can’t be used for removing www from URLs ?

    Also for trailing slashes, why would your code work better than this example which I picked up in the same thread and comments?

    # If requested resource does not exist as a file
    RewriteCond %{REQUEST_FILENAME} !-f
    # and does not end with a period followed by a filetype
    RewriteCond %{REQUEST_URI} !..+$
    # and does not end with a slash
    RewriteCond %{REQUEST_URI} !/$
    # then add a trailing slash and redirect
    RewriteRule (.*) $1/ [R=301,L]

    I am just looking for something universal I can just upload and it works, which is the advantage sometimes of plugins.

  2. Alister
    Posted 7 years, 9 months ago // Permalink

    Andy, can do.

    # If subdomain www exists, remove it first
    RewriteCond %{HTTP_HOST} ^www\.([^\.]+\.[^\.]+)$ [NC]
    RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

    … should do the trick. You’ll need this as your first rule, ideally.

    Let me know how it goes. At the end of all this I’d like to post the “ideal generic” .htaccess file for WordPress users… if it makes sense to do that and if we’ve really added some value here :)

  3. Posted 7 years, 6 months ago // Permalink

    So… Did you ever come up with the ideal generic .htaccess file for WordPress? :)

  4. Posted 7 years, 6 months ago // Permalink

    Brilliant. Sadly, I am not brilliant, lest I would know how to work this myself. The one thing that this solution does not appear to do which the permalink redirect did is convert ?p=# into the permalink on the fly. I send out ?p=# type links to publicists because my regular permalinked URLs can get a little…long. And it beats having to go to tinyurl. Am I simply up a creek on this one?

  5. Posted 7 years, 6 months ago // Permalink

    @Widgett Walls — yes there is a plugin to do that automatically, and it is called “Permalink Redirect”. It can automatically redirect /?p=# style URL into full URL defined by your permalink structure.

    Oh wait. Sorry. I have also just noticed that this is the WordPress plugin mentioned in the article that you don’t and shouldn’t use :)

  6. Posted 7 years, 6 months ago // Permalink

    Scott: Story of my life: It’s what you need! But it’s bad for you! But it’s what you need! No, it’s bad for you! Whether chocolate, caffeine or WordPress plugins, in the end it’s all the same. :-(

  7. Posted 7 years, 6 months ago // Permalink

    The problem with these rewrite rules is they don’t work if your blog is not in the root. ie.

    www. example.com/blog

    becomes a mess under these two rules
    The problem is I can’t quite make it work with both removing the www. and adding the trailing slash. Either one works and/or one breaks the other.

    Added bonus for removing index.php if someone tries to do example.com/blog/index.php

  8. Robin
    Posted 7 years, 5 months ago // Permalink

    How about if I *don’t* want the trailing slash? ;)

    I poked and prodded around in my .htaccess a bit but all I got was bad redirecting in an infinite loop.

    Oh, and nice all-domain no-www code. I’ve been looking for something like that.

  9. Posted 7 years, 5 months ago // Permalink

    Alister this page looks bad :)
    I thought you may need to know.

  10. Posted 7 years, 5 months ago // Permalink

    Weird.. now it looks great but a minute ago was full of database errors.. :D
    My bad.

  11. Posted 7 years, 2 months ago // Permalink

    You are so right, i wish they would start integrating it into the base of WP sooner rather than later ya know..

    @ http://www.askapache.com/htaccess/apache-htaccess.

  12. Posted 7 years, 1 month ago // Permalink

    Thank you! Your www redirect worked better than what I had been using, and the force trailing slash works great. I’ve had the worst time getting that working on my site before now. It seems important to put the trailing slash rule before the standard wp rules — you mentioned that’s where you put it, but might be a good idea to emphasize this if you update your post at all.

    Thanks again!

  13. Posted 7 years, 1 month ago // Permalink

    Some free hosting sites don’t allow .htaccess to be used. One hosting company I use offers 5GB space and 500GB bandwidth but they have file type rules and .htaccess isn’t allowed with the free level. So the Permalink Redirect plugin is a GREAT.

  14. Posted 6 years, 8 months ago // Permalink

    hey thanks a lot for the redirection code .. i’ve ben trying all da to get it to work on my site..

    http://www.discussheroes.com

  15. Posted 6 years, 5 months ago // Permalink

    An old topic, but I have a relevant point, url’s with WWW rank better than those without. I don’t know why…..but the stats show that they do.

  16. Posted 5 years, 9 months ago // Permalink

    Excellent — that’s 2 problems solved. Now why won’t the 301 redirects work with this code? For instance, I want to redirect one specific page to the next, and it goes directly to my 404 page, instead of the intended page.

    this is what I have in my htaccess file:

    Options +FollowSymLinks
    RewriteEngine on

    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^www.clickstomysite.com$ [NC]
    RewriteRule ^(.*)$ http://www.clickstomysite.com/$1

    [R=301,L]

    RewriteCond %{REQUEST_URI} ^/[^\.]+[^/]$
    RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1/ [R=301,L]

    redirect 301 /AboutUs_Clicks.htm
    http://www.clickstomysite.com/about

    ErrorDocument 404 http://www.clickstomysite.com/404.html

  17. Leo van Puffelen
    Posted 4 years, 10 months ago // Permalink

    Totally agree with you Alister. Also don’t use canonical link plugins as they all declare wrong urls to be the canonical one. I tried them all on this site about website hosting and they appear to corrupted.

  18. Posted 4 years, 10 months ago // Permalink

    I am having a weird problem with my blog and I haven’t been able to find an answer, I believe it could be fixed with some editing to the .htaccess file but I don’t know.
    when I get a search hit from google the link shows up like so:
    http://realecig.com/?/ecigs/dragonfly/
    When it should be:
    http://realecig.com/ecigs/dragonfly/
    There is an extra question mark added to the url which shouldn’t be there. Does anyone know how to get rid of this?

  19. Posted 4 years, 6 months ago // Permalink

    I learn your modification to .htacces. It’s looks simple but powerful.

  20. Posted 3 years, 9 months ago // Permalink

    Yes, you’re absolutely right.. I also don’t use plugins for simple handy things. Currently I’m having a problem with trailing slash. At my permalink (some times for long permalink) the slash is often missing. Every time I can’t check, No idea why it’s happening.. can you suggest any simple trick for this? :)

  21. Posted 2 years, 11 months ago // Permalink

    I’m not really good at this .htaccess stuff… so it’s good that wordpress has some automated plugins like the ones you mentioned for newbies like me :P

28 Trackbacks/Pingbacks

  1. but the fact remains, sometimes someone comes along offering to kill a flea with an elephant gun, and well… it’s time to just come right out and admit that was the wrong approach. The two offending plugins on my hitlist for today are the [...] (Read on Source)

  2. In Search of the Ultimate Htaccess file A couple of months ago Alister Cameron posted a simple solution to .htaccess such that you didn’t need to use a plugin to convert URLs using www to URLs without. At the time I suggested a couple of improvements, and also mentioned I would post about it here on my blog, hopefully to help develop what could be looked on as the

  3. In Search of the Ultimate Htaccess file A couple of months ago Alister Cameron posted a simple solution to .htaccess such that you didn’t need to use a plugin to convert URLs using www to URLs without. At the time I suggested a couple of improvements, and also mentioned I would post about it here on my blog, hopefully to help develop what could be looked on as the

  4. In Search of the Ultimate Htaccess file A couple of months ago Alister Cameron posted a simple solution to .htaccess such that you didn’t need to use a plugin to convert URLs using www to URLs without. At the time I suggested a couple of improvements, and also mentioned I would post about it here on my blog, hopefully to help develop what could be looked on as the

  5. In Search of the Ultimate Htaccess file A couple of months ago Alister Cameron posted a simple solution to .htaccess such that you didn’t need to use a plugin to convert URLs using www to URLs without. At the time I suggested a couple of improvements, and also mentioned I would post about it here on my blog, hopefully to help develop what could be looked on as the

  6. In Search of the Ultimate Htaccess file A couple of months ago Alister Cameron posted a simple solution to .htaccess such that you didn’t need to use a plugin to convert URLs using www to URLs without. At the time I suggested a couple of improvements, and also mentioned I would post about it here on my blog, hopefully to help develop what could be looked on as the

  7. However telling webmasters that they should fix these issues isn’t enough, webmasters & bloggers need solutions. In Search of the Ultimate Htaccess file A couple of months ago Alister Cameron posted a simple solution to .htaccess such that you didn’t need to use a plugin to convert URLs using www to URLs without. At the time I suggested a couple of improvements, and also mentioned I would post about it here on my blog, hopefully to help develop what could be looked on as the

  8. Fixing my Permalink Redirect issue left me feeling stupid. I knew I needed .htaccess rules instead of using PHP processing, but I didn’t expect the results. In my search for .htaccess rules, I came across this post addressing my issue specifically. In fact, so specifically the site even mentioned my name as a proponent of Permalink Redirect! I guess I need pay more attention the blogosphere; there might be some other worthwhile enhancements out there for me.

  9. , I wrote about the .htaccess file for the Apache web server and rewrite rules to make your blog land on a single front index page. I spotted the code and other interesting things at Niche Marketing – Andy Beard which took to me to Alister Cameron // Blogologist where I was able to read even more. Both of these blogs are valuable resources for anyone that wants to continue to optimize their own blogs for the best search engine performance. In Part 2, I wrote about a plugin and a theory on reducing outbound

  10. In Search of the Ultimate Htaccess file A couple of months ago Alister Cameron posted a simple solution to .htaccess such that you didn’t need to use a plugin to convert URLs using www to URLs without. At the time I suggested a couple of improvements, and also mentioned I would post about it here on my blog, hopefully to help develop what could be looked on as the

  11. [...] Adsense WordPress Theme站点回顾:一个半月走过的日子Two WordPress plugins you don’t need and shouldn’t use5 SEO tips for WordPress part110 SEO tips for [...]

  12. [...] couple of months ago Alister Cameron posted a simple solution to .htaccess such that you didn't need to use a plugin to convert URLs using www to URLs [...]

  13. [...] solutions. In Search of the Ultimate Htaccess file A couple of months ago Alister Cameron posted a simple solution to .htaccess such that you didn’t need to use a plugin to convert URLs using www to URLs without. At the time I [...]

  14. [...] processing, but I didn’t expect the results. In my search for .htaccess rules, I came across this post addressing my issue specifically. In fact, so specifically the site even mentioned my name as a proponent of Permalink Redirect! I [...]

  15. [...] You Need Permalink Redirect? Via CaveMoney50, Alister Cameron wrote about Two WordPress Plugins You Don’t Need and Shouldn’t Use. Number 1 on the list: Permalink Redirect, closely followed by Matt’s No-WWW plugin. [...]

  16. [...] I spotted the code and other interesting things at Niche Marketing – Andy Beard which took to me to Alister Cameron // Blogologist where I was able to read even more. Both of these blogs are valuable resources for anyone that [...]

  17. [...] แต่เดี๋ยวก่อน ก่อนจะใช้งาน ถ้าเวปของท่านมีคนเข้าใช้งานเป็นหมื่นเป็นแสนในแต่ละวัน plugin ตัวนี้อาจจะไม่เหมาะก็ได้ CaveMoney50 ได้กล่าวถึงการใช้งาน GPU อันหนักหน่วงอันเนื่องจากโปรแกรม และ plugin ใน wordpress และ alistercameron ก็ได้พูดถึง plugin 2 ตัว ที่ไม่ควรใช้มากที่สุด Tags: permalink redirect plugin, wordpress plugin [...]

  18. [...] I appreciate it, but I tend to agree with this article. http://www.alistercameron.com/2007/0…-shouldnt-use/ [...]

  19. [...] I used my search mojo to see that someone has already described the cure so I won’t have to: Two WordPress plugins you don’t need… and shouldn’t use. Tags: links, off page seo, on page seo, page rank, plugins, pr, search engine friendly, search [...]

  20. [...] You Need Permalink Redirect? Via CaveMoney50, Alister Cameron wrote about Two WordPress Plugins You Don’t Need and Shouldn’t Use. Number 1 on the list: Permalink Redirect, closely followed by Matt’s No-WWW plugin. [...]

  21. [...] from Alister Cameron. It works for Linux/Unix and requires .htaccess file access. In the web root directory .htaccess [...]

  22. [...] plugin, its now half-way …www.askapache.com/htaccess/htaccess-p …  – lingua: en  – copia cacheTwo WordPress plugins you don’t need and shouldn’t use12 Jan 2007 … Technorati Tags: mod_rewrite, htaccess, wordpress, plugin, wordpress plugin, [...]

  23. [...] trailing back-slash if missing (Can also be done with htaccess or [...]

  24. [...] from Alister Cameron. It works for Linux/Unix and requires .htaccess file access. In the web root directory .htaccess [...]

  25. [...] 来自:Two WordPress plugins you don’t need and shouldn’t use [...]

  26. [...] plugins and widgets Ultimate List of Nofollow Dofollow Plugins The Essential WordPress Plugins Two WordPress plugins you don’t need and shouldn’t use Best WordPress Plugins Nominations and Results wordpress plugins installed here 10 Most Amazing [...]

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*

Current ye@r *

    • splash.oiopublisher.com
    • madmimi.com
    • marketsamurai.com
    • www.medialayer.net
    • Advertise Here

  • My Posts in Your In-box!

    Enter your email address here for instant updates in your inbox, whenever I post something new.
    Your email address is in safe hands. Relax!
© Copyright 2007 Alister Cameron. All Rights Reserved Theme // Sitemap // RSS