• Home

  • Custom Ecommerce
  • Application Development
  • Database Consulting
  • Cloud Hosting
  • Systems Integration
  • Legacy Business Systems
  • Security & Compliance
  • GIS

  • Expertise

  • About Us
  • Our Team
  • Clients
  • Blog
  • Careers

  • VisionPort

  • Contact
  • Our Blog

    Ongoing observations by End Point Dev people

    Slash URL

    Jeff Boes

    By Jeff Boes
    December 4, 2012

    There’s always more to learn in this job. Today I learned that Apache web server is smarter than me.

    A typical SEO-friendly solution to Interchange pre-defined searches (item categories, manufacturer lists, etc.) is to put together a URL that includes the search parameter, but looks like a hierarchical URL:

    /accessories/Mens-Briefs.html

    /manufacturer/Hanes.html

    Through the magic of actionmaps, we can serve up a search results page that looks for products which match on the “accessories” or “manufacturer” field. The problem comes when a less-savvy person adds a field value that includes a slash:

    accessories: “Socks/Hosiery”

    or

    manufacturer: “Disney/Pixar”

    Within my actionmap Perl code, I wanted to redirect some URLs to the canonical actionmap page (because we were trying to short-circuit a crazy Web spider, but that’s beside the point). So I ended up (after several wild goose chases) with:

    my $new_path = '/accessories/' .
       Vend::Tags->filter({body => (join '%2f' => (grep { /\D/ } @path)),
           op => 'urlencode', }) .
       '.html';
    

    By this I mean: I put together my path out of my selected elements, joined them with a URL-encoded slash character (%2f), and then further URL-encoded the result. This was counter-intuitive, but as you can see at the first link in this article, it’s necessary because Apache is smarter than you. Well, than me anyway.

    apache interchange perl seo


    Comments