Aja Lapus: Blogging with Standards

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 Search Permalink

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

27 Responses to “Search Permalink”

  1. 1

    Great job. Would it be possible to provide examples of the ugly and friendly URLs?

    Titanas posted on 31 August 2007, 20:52

  2. 2

    Pingback Pinged on 31 August 2007, 21:33

  3. 3

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

    Aja posted on 31 August 2007, 22:17

  4. 4

    Using this on my site now, thank you!

    Jerry posted on 1 September 2007, 04:19

  5. 5

    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.

    Titanas posted on 1 September 2007, 19:06

  6. 6

    Great plugin! I’ve been looking for a plugin or hack to do this for a while.

    Jared Schwager posted on 2 September 2007, 00:05

  7. 7

    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.

    UFCDrill.com posted on 6 September 2007, 00:50

  8. 8

    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!

    Jared Schwager posted on 6 September 2007, 21:02

  9. 9

    Pingback Pinged on 10 September 2007, 02:39

  10. 10

    Great little plugin thanks!

    freetemplatesformyspace.com posted on 10 September 2007, 04:41

  11. 11

    Pingback Pinged on 11 September 2007, 19:16

  12. 12

    Pingback Pinged on 20 September 2007, 21:20

  13. 13

    Pingback Pinged on 25 September 2007, 04:05

  14. 14

    Pingback Pinged on 29 September 2007, 19:16

  15. 15

    Pingback Pinged on 30 September 2007, 04:45

  16. 16

    Using on my site now, thank you aja!

    Bilgidepom posted on 12 October 2007, 20:46

  17. 17

    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

    Matt posted on 1 November 2007, 11:04

  18. 18

    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.

    Aja posted on 1 November 2007, 13:21

  19. 19

    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? :)

    Matt posted on 1 November 2007, 22:22

  20. 20

    Nevermind. Got it working doing some tricks with Redirections plugin: http://urbangiraffe.com/plugins/redirection/

    Thanks anyway! ;)

    Matt posted on 2 November 2007, 06:25

  21. 21

    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 :(

    zhrance posted on 3 April 2008, 02:00

  22. 22

    @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. :)

    Aja posted on 4 April 2008, 13:19

  23. 23

    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!

    zhrance posted on 16 April 2008, 05:16

  24. 24

    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!

    zhrance posted on 22 April 2008, 14:34

  25. 25

    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. :)

    Aja posted on 30 April 2008, 15:16

  26. 26

    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?

    zhrance posted on 1 May 2008, 01:21

  27. 27

    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.

    Aja posted on 1 May 2008, 01:32

Post another response »

Leave a Reply

Reply guidelines: Only the XHTML elements <a href="" title="">, <abbr title="">, <acronym title="">, <blockquote cite="">, <code>, <em> and <strong> are allowed. Line breaks and paragraphs are automatically generated. I am using a comment spam filter. Don't fret if your replies do not appear right away—don't repeatedly submit them. I have the right to remove or edit comments I feel inappropriate for my site.

Copyright and Publication Information

Copyright © 2005–2008, Aja Lorenzo Lapus. All rights reserved.
All content are properties of Aja Lorenzo Lapus unless stated otherwise.