Articles tagged in moved

  1. Search Excerpt WordPress Plugin


    I have moved this project to my programming/Internet blog -- Search Excerpt WordPress Plugin.

    WordPress' searching capability is a bit mediocre at the moment. It splits up the keywords, digs out texts using SQL LIKE statement, and returns all entries that match the criteria, in a reverse chronological order. Then the default template will display some of these entries, using the template function the_excerpt(), which basically returns the first 55 words, HTML striped.

    To have a more functional search, i.e. returning entries in the order of relevance, I think WordPress would need to either try to index the text (which is wha Search Reloaded plugin is about), or utilise MySQL's full-text search functions. Both would require modifying the database layout and change "the loop". Yuk.

    To have a more meaningful result display, i.e. returning text snippets surrounding the matches, is however quite easy to achieve. Thus my Sunday evening's little project, "Search Excerpt" plugin that displays more meaningful result than the default first 55 words.

  2. Permalink Redirect WordPress Plugin


    I have moved this project to my new programming/Internet blog -- Permalink Redirect WordPress plugin.


    I am not sure why the WordPress people insist that,

      GET /2005/05/29/foo-bar HTTP/1.1

    is exactly the same as

      GET /2005/05/29/foo-bar/ HTTP/1.1

    If you have not spotted the difference, one has a trailing forward slash '/' in the URI and one does not. For one is requesting the content of object 'foo-bar' under directory '/2005/05/29/', and another one is requesting the content of the index file under directory '/2005/05/29/foo-bar/'. Although many of us would usually ignore the trailing slash, and write out the URL without it, web servers usually will correct this behaviour by replying a 301 permanent redirect to an URL with the trailing slash, if 'foo-bar' is indeed a directory.

    However, not so with the default mod_rewrite rules generated by WordPress. To save number of rules need to be generated, WordPress short-cuts the regular expression to allow optional trailing slashes at the end of the URL. This results that you can now point to the same entry/archive with or without the trailing slash - which goes against what a search engine would recommend. Here is an extract of Google's recommendation to the webmasters, under "Quality Guidelines - Specific recommendations":

    Don't create multiple pages, subdomains, or domains with substantially duplicate content.

    Now if I search Google for certain keywords, I sometimes see two results came back from the same domain - same blog entry but one with a trailing slash in its URL, and one does not. For example, mtsend. This is certainly not what I have desired. I used to modify all the mod_rewrite rules generated by WordPress, so that Apache will issue a 301 redirect if the trailing space is missing. However, it is tedious, and not compatible when WordPress upgrades. Moreover, your .htaccess becomes huge and getting unmaintainable.

    Therefore, this simple WordPress 1.5+ plugin is written. It compares the request URI, and if it does not match the permalink, a redirect will be sent back instead. It works not only for individual blog entries, but also yearly/monthly/daily and category archives, so that there is always only be one URL for each of your blog entries and archives.