Search Permalink

Search Permalink redirects search form queries to cruft-free permalink URIs.

For example, the search term “foo” was entered on the search <form>. A browser would usually GET the page using this URI:

http://example.com/?s=foo

Search Permalink would redirect this query to a better-looking address clearly indicating that a search was made, like this:

http://example.com/search/foo/

Download Plugin

Change Log

Version 1.1
Released 17 October 2007

Changes:

  • Added client-side script to lessen server-side processing and redirects.
Version 1.0.1
Released 14 October 2007

Changes:

  • Support for any combination of permalink and query string requests for search term and page number.
Version 1.0
Released 25 August 2007

Changes:

  • Fixed URL encoding bug.
Version Beta 1
Released 19 August 2007

Changes:

  • First beta release of the Search Permalink plugin.

License

Copyright © 2007 Aja Lorenzo Lapus

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

Read the full license

69 comments

  1. Well, yes of course. Maybe visitors would understand what the plugin does easier that way. Thank you. 🙂

  2. Great job! Your plugin is awesome and does redirect even old ugly post links “/?s=foo” to the new beautiful permalinks “/search/foo” when clicked on them. This is something that Alex’s solution doesn’t offer.

  3. I get this:

    Not Found
    The requested URL /search/chuck/ was not found on this server.

    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

  4. Still love using your plugin, but I use the “WP Plugins Tracker” from wp-plugins-db.org and your plugin doesn’t seem to be in their database, so I have no idea what the latest version of your plugin is.

    Could you perhaps add your plugin to the database? I love using their plugin version tracker as it saves me so much time. Thanks for the great plugin!

  5. Any chance of having a Search Permalink like: mysite.com/<KEYWORDS> instead of mysite.com/search/<KEYWORDS>?

    Where <KEYWORDS> are keywords. Examples:

    1. mysite.com/wordpress+plugins
    2. mysite.com/chocolate+cake+easy
  6. No, Matt. Sorry.

    The “power” of my plugin relies on WordPress’ internal permalink handling, which uses /search/ to determine keywords and /page/ to determine pages. Since what you wanted interferes with how WordPress handles the quasi-static Pages’ permalinks—whose keyword/slug appears just below the root—it could be difficult to implement.

    Anyway, you are free to modify mine to suit your needs. I think you’ll need Apache mod_rewrite for that one.

  7. Yeah, I managed to get the search like I wanted but it got messed with WP static pages, which means 404 not found.

    Now I need to find a way of showing static pages as “www.mysite.com/static/about” instead of “www.mysite.com/about”. Any tip? 🙂

  8. Your plugin works great for Firefox but doesn’t funtion in IE7 are you going to fix this? Because this is a great solution for me except that IE7 ain’t working 🙁

  9. @zhrance: I’ve managed to test it on IE7 and it works on the server-side. What’s seems to be the problem on your part? Maybe I could resolve it with a little more detail. 🙂

  10. Hey Aja, sorry for my late reply. My major problem is that my search funtion doesn’t work at all, well atleast I got a permalink problem (has something to do with ISAPI Rewrite). I activated again your plugin-in on my blog. If you open my blog (www.plakballen.nl) in Firefox and you type in “Kate” on the right where my search funtion is located everything seems to work fine, if you now do the same thing in IE7 it’s not going to work? I hope you can help me you are my last solution to get my search funtion working. if you need more detailed information let me know!

  11. Hi Aja, I am still strugeling with my search funtionality. tryed almost every search related plug-in I could find in the WordPress database, nothing brings me a solution. I really hope you can help me out!

  12. I still don’t know what the problem is. I searched for “kate” on your blog using IE7 and received two good matches (Winslet and Hudson). It even made use of the “search permalink” URL style (i.e., http://www.plakballen.nl/search/kate). So, I’m assuming nothing has gone wrong. 🙂

  13. Well Aja, in the mean time I searched for other solutions and I found a topic about the friendly search url on this blog.

    http://alexking.org/blog/2007/08/30/friendly-search-urls (I also saw you replied on it).

    I am recently using now this solution because it works out for me, so yes it works now in IE7 😉 Only got one issue left maybe you can help me out with that…

    The url structure is now plakballen.nl/search/searchterm, I would love to change the word “search” by “zoek” (dutch translation for search). Do you know how I can do that?

  14. Oh. Sorry I wasn’t able to help you with that. Hmm. I think a L10n setting should take care of that. But, I’m not entirely sure how to apply L10n with WordPress, for the default English is enough for me.

    In any case, it could probably be solved by using rewrite rules to redirect zoek to internal search URLs. But, all I know is Apache’s mod_rewrite and not IIS’s ISAPI_Rewrite engine as you have mentioned earlier, if there’s even significant difference among the two. And, that possible L10n solution would be much proper, IMO.

  15. Hi, I love your plugin and it works great. Except that on a particular site I have, it is common for people to search for terms with a “/” (forward slash) in them – for example part numbers in this industry are often written this way. This causes a nasty 404 error (which doesn’t default to WP’s 404). Any ideas how to overcome this? Because otherwise, this plugin does exactly what I want! Thanks.

  16. Howdy, I’m trying out this plugin on one of my sites and it works nicely except that it makes the pages loading really slow. I have to wait about two seconds for every page (using firefox firebug to debug) to load. When I turn off the plugin the pages load fast again. Is this a “feature” or a bug?
    Cheers,
    Jens

  17. Jens, the plugin loads a client-side script to eliminate the need for the server to do the redirection if the user has JavaScript enabled. That may have contributed to the extra time the page will have loaded.

    I haven’t been updating my plugins in a while as I have loads of schoolwork to do, but I sure hope I could optimize them soon. Sorry for that little problem.

  18. I think this is a great plugin! Very usable. But I have a question for you: Is there an option to change the word “search” for another like “buscar”?

    My first language is spanish and the first language of my visits is spanish too, so I will greatful that.

  19. @Daidaros – you can manually rename the word “search” to “buscar” inside search-permalink.php. You need to change the word “search” in line 68 and line 83. 🙂 You can rename it, but after you try searching, it’s a 404..

    wooooot!

  20. Hi Aja, is the redirection Google friendly?
    I mean: is the plugin doing a 301 from /?s= to /search/….?

    If not: HOw can I do it?

    Thanks

  21. It seems a very useful plugin. Just a few questions:

    1) Which is the latest WP version your plugin is compatible with? (in WP plugin page it reads “Compatible up to: 2.2.2”)

    2) Can the search results be paged ?

    3) Can I attribute custom templates to the search results?
    I apologize to you if it is off-topic, what I need to create on my website are links pointing search results, i.e.
    http://example.com/search/rome
    http://example.com/search/venice etc..
    with each page displaying search results coming with its own template (so ‘rome’ page different from ‘venice’ page etc…)
    If I create a page ‘http://example.com/search/rome’ in WP with its own template, is it going to incorporate the search results when I perform a search for keyword ‘rome’ — once I installed your plugin — ?

    Many Thanks

  22. Can We Change /search/ permalinks to another links?

    Example :
    domain.com/search/keyword+keyword2
    Change To
    domain.com/file/keyword+keyword2

    Can we do this? Please Tell me..
    I was try to change but the page display 404

  23. Any plans to make your plugin work with WordPress v2.8? As of now I receive “internal service error” with your plugin enabled.

Leave a comment

Your email address will not be published. Required fields are marked *