seo

Fix SEO problem in drupal (give 301 to node/xx request)

this was a problem with www.tecnomagazine.it :

http://www.tecnomagazine.it/recensioni/casio-exilim_ex-z60/442

could be accessed from /node/442

Solution is to redirect all /node/[0-9]* url to the aliased one
... and is very simple in code:

includes/path.inc :

function drupal_init_path() {
  if (!empty($_GET['q'])) {
    // add this conditional
    if(preg_match('/node\/[0-9]*$/',$_GET['q'])) {
      include "includes/common.inc";
      $newq = trim(url($_GET['q']),'/');
      if($newq!=$_GET['q']) {
Syndicate content