When I add a file extension after the contextual filter in my view's path it no longer works. The path with wildcard is: "section/%.htm"; can this be done or do I have to write some custom PHP to trim the URL of the file extension?

Please note that this is a legacy site which is rolling out section changes in phases, so there can be absolutely no URL changes while we convert the site to Drupal.


Why not use the redirect module (or just plain ol' .htaccess 301 redirects) to redirect /section/file.html to /section/file ?

I understand the client doesn't want URLs to change, but doing a proper 301 redirect would preserve any SEO rankings they are trying to retain.

  • I would love to, that of course was my initial suggestion to the business. It was advised by our SEO consultant that adding these redirects and then adding them again in 6 months when we change the site's architecture could affect ranking. Unfortunately this site is in such bad shape that it requires us to move it into Drupal now before the re architecture decisions have been made. It is very complicated and am now trying to weigh our options. There is another option of making all these pages nodes but then we will have 4k nodes with absolutely no content. – Michael E Jan 9 '12 at 15:48
  • Here is an idea: You could import that content into Drupal as node via the feeds module. Using path auto you could add .html – Aaron Ortega Jan 10 '12 at 0:21
  • That was one of the options, we are building another section that way and just using a View Block but was hoping to put as little effort as possible into this one section that will be changing in half a year. I think we are going to push back and suggest a change that will improve the section's URLs. It just makes no sense to replicate the current state. – Michael E Jan 11 '12 at 2:48

Drupal does not contain static content, it stores all content in a database which gives it great flexibility in how it assembles your content. You do not call static pages, although it is possible to add each static page in your current site into a Drupal page. The power of Drupal is in the flexibility with which you can assemble content.

The proper format for URLs for views would be section/%/whatever-you-choose. The "%" serves as a wildcard and the third position might define variations that might define various subsections of the section/% content, depending upon how you define various page variations within the view definition.

A view path is not intercepting the URL request. What you are doing with the path is assigning a name for the view. Other content on the site should have different names/paths. When you use a '%' in a path you are actually assigning many possible names to that view and the view varies the content for each value used in the wildcard according to the contextual filter definition you provide.

Before beginning work on a Drupal conversion you may want to do view some tutorials etc. There is fairly comprehensive coverage at Lullabot.com, buildamodle.com, or Lynda.com that will give you a broader perspective in short order. Armed with a fuller perspective of what is possible, you may find yourself rethinking how you want to stage a conversion.

  • We are not trying to call static pages. On the current site this section is dynamic and all the content is coming from the database. The one thing I can't seem to replicate is adding a file extension to the path to simulate the url rewriting that is currently in place. Does that help? Thanks for the advice on the consulting, we actually have Lullabot coming in next week. – Michael E Jan 9 '12 at 15:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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