0

Our former website (that was hooked with Google Analytics) had the following URL (i.e. Example URL) for a staff member:

http://www.example.com/research/teams/staffname.html

I have recently re-designed the website using Drupal 7 (Views 3) and other required modules. While designing the website, the structure of the most URL addresses changed.

Google already had indexed the old website and had/have the old URL addresses. After the complete re-design of the website, I did the following:

  1. Enabled the Google Analytics module (supplied it the same Google Analytics ID used for the former website)
  2. Installed/Enabled the xmlsitemap module, configured the content types to provide URL for and generated a new sitemap.xml file
  3. Created Google Webmaster Tools (and Bing Webmaster account) and uploaded the sitemap.xml

Google has so far indexed 23 URL out of 63 (More indexing to be done!). At the moment googling the site, show up the website with some new links (probably the recently indexed links) and some older links. Clicking the OLD links of course display

"The requested page "/studentships/studentships1.html"

Hopefully by the time Google index all 63 links, there will be no OLD links left however, there happen to be another issue.

In the new website, I have a View page which is composed of a few View Attachments where each attachment lists a group of Scientists/staff. Visiting Research page

http://www.example.com/research 

Renders four/five Science types sections and then under each section there is a list of Scientists. Each staff/scientists profile has a custom URL (yes I do use pathauto but, not for staff content type) as follow:

/research/group/{staffusername} hence http://www.example.com/research/group/{staffusername}

If you notice there is a partial match in the URL of old website and new website

  http://www.example.com/research

The problem I am having with the above URL is that, requesting any of the following URL variation would work (View Page is rendered) as if the above URL is requested

  http://www.example.com/research/*
  http://www.example.com/research/*/* 
  .... 

When I click the old URL for accessing a staff profile which looks as follow :

 http://www.example.com/research/teams/{staffusername}.html 

That executes the following

http://www.example.com/research 

Even though after /research there is no match (I should see an error there for URL mismatch). Why I want strict URL matching:

  1. Accessing a staff profile using old link and ending up in the research page where all the staff is listed, is not a good navigation
  2. Google bot will never come across a 404 hence, will consider the OLD staff URLs as valid and probably will never get rid of them from their search index/history (Google has listed most of the links of Old website as 404 but, not listed any of the OLD staff profile URLS).

What should I do to instruct the View page to only display /research page when the URL perfectly matched?

The view should run only when the request URL is exactly as follow

http://www.example.com/research 

The staff content type nodes has the following Custom URL

research/group/{staffusername}

The Research View Page path is research, this issue of not doing strict URL matching is true for all of the Views of type Page in the new Drupal site. For example, the following is valid Career view URL

http://www.example.com/career (with View Page path as "career"

But any of the following URL requests work

http://www.example.com/career/*

Is this default behaviour of views?

Sorry for the level of details, probably too much. Thanks anyway.

1 Answer 1

1

This isn't Views behaviour, it's standard for the Drupal menu system. Extra path components (separated by slashes) are ignored if they don't match a more specific menu entry. So if you have a menu entry for path xxx/yyy it'll also receive requests for xxx/yyy/zzz and xxx/yyy/zzz/aaa.

Rather than a 404, why not serve a 301 redirect? That's better for SEO. If you can't do that at the server level (always preferable for performance) then a module such as https://www.drupal.org/project/match_redirect might help.

See: https://api.drupal.org/api/drupal/includes%21menu.inc/group/menu/7

When responding to a page request, the menu system looks to see if the path requested by the browser is registered as a menu item with a callback. If not, the system searches up the menu tree for the most complete match with a callback it can find. If the path a/b/i is requested in the tree above, the callback for a/b would be used.

2
  • Do you mean to say that I cannot stop this behaviour of Drupal? If you have a link to the documentation or resource that explain such a behaviour, please provide it.
    – Raf
    Commented Sep 24, 2014 at 15:40
  • I have edited my answer to provide a source. Commented Sep 25, 2014 at 9:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.