It will be no surprise to most of you that I’m all for using WordPress to power library websites. The list of reasons to use it is long, but there’s one thing of which I’m not too terribly fond. The URLs. I dislike when URLs/look/like/this/and/contain a bunch of words and slashes, and WordPress URLs can get to be that way.
Let me say straightaway that WordPress URLs can easily be changed from something ugly and useless like:
to something pretty like:
That’s what I use on this site just because I’m picky and I like how clean it looks. WordPress URLs can move beyond just being not ugly to being useful and informative. Something like:
Great! Moving beyond post numbers and putting content in the URLs is good for spiders indexing sites, right? This even prettier permalink arrangement uses WordPress page titles as URLs. It isn’t difficult to accomplish. Here’s the page in the WordPress Codex on Using Permalinks.
What’s not to like then? Even though they’re pretty, WordPress URLs can get long when pages are nested under other parent pages, especially if the page titles are more than one word. It would be possible to not have any nested pages, but it is useful for the sake of organization. I also do it so only main pages appear on the header of my library’s site.
The URL for the Loan Periods page on the NPPL site isn’t too long:
but the URL to our Click-A-Story page is way too long. How are we supposed to advertise the program with a URL like this?
Yikes! That’s way too unwieldy to put on promotional material.
fun with 301 redirects
To use 301 redirects it is necessary to edit a special file called .htaccess. It is a little tricky making and or finding your .htaccess file, but the Codex has a great section called Where’s my
My redirects are probably not 100% well formed, but they work. Here’s how I changed the long Click-A-Story URL into http://www.nplibrary.org/clickastory.
Redirect 301 /clickastory http://nplibrary.org/kids-and-teens/click-a-story
Redirect 301 /wifi http://nplibrary.org/about/wifi-at-the-nppl
To promote patron access to their accounts we can advertise http://www.nplibrary.org/account instead of using the long Polaris URL.
Redirect 301 /account http://www.wccls.org/polaris/patronaccount/default. aspx?ctx=1.1033.0.0.1
While our library cooperative did a nice job making the URL http://www.wccls.org/search to lead to a search page, http://www.nplibrary.org/find will take users what I’ve found to be a more reliable search page.
Redirect 301 /find http://www.wccls.org/polaris/Search/default. aspx?ctx=1.1033.0.0.1
Using these redirects to create URLs that are easy to print, remember and use is the best of both worlds. The real URLs contain good descriptive content for search engine spiders, and patrons have easy URLs. Hurrah.
I’d like to get a bit more fancy and use mod_rewrite for these redirects. mod_rewrite is an Apache server module that can manipulte and rewrite URLs. I tried to use it before and had a bit of success, but I’m not ashamed to say it isn’t easy. Even its own documentation calls it voodoo. With mod_rewrite, I’m pretty sure it would be possible to not only redirect from user-friendly URLs, but also display them in the address bar. If anyone wants to tutor me I’m all ears.
One more thing. Using redirects isn’t just for WordPress. I’m sure there are plenty of library URLs that could use simplifying and redirects also might come in handy when doing website redesigns. When you need to change the structure of your URLs that are already indexed, and in your users’ bookmarks, you can do so without fear of losing rank or causing 404s.