samedi 25 avril 2015

Remove unnecessary URL parts/parameters

I've got a blog with article-urls like this http://ift.tt/1FlHGHF

My old blog had URLs like this: http://ift.tt/1KfFPE0 etc.

When the article is valid but everything following it is unnecessary I would like to strip out parts and parameters after the URL.

This http://ift.tt/1KfFPE0

or this http://ift.tt/1FlHJD2

becomes this http://ift.tt/1FlHGHF

Currently I've got a catch-all route which will redirect the user to the error-page

How can I strip out unnecessary parts?

Here's the router.js I currently use for articles:

this.route('blog', { 'path' : 'blog/'}, function() {

  this.route('post', { 'path' : ':permalink' })
  this.route('not-found', { 'path' : 'not-found'})
});

// Error routes
this.route('not-found', { path : '/not-found'})
this.route('catch-all', { path : '/*path'})  // redirects to not-found




Aucun commentaire:

Enregistrer un commentaire