I have a couple of sites that used to be written in aspx. After launching these sites on Drupal I noticed search engines still have the old URLs indexed with .aspx in the path (e.g.: example.com/some_location.aspx) but when a person goes to that page they are served an Nginx 404 page... The issue for me is that I can not create 301 redirects inside Drupal for these pages because it doesn't even make it to the website before Nginx stops the request.

What is the best way to override the 404 and allow it to hit Drupal's 404 instead?

Side note: In general, this may be a usability problem for the common web user who are intimidated by un-styled machine generated pages :)

CommentFileSizeAuthor
barracuda_log.txt3.08 KBjeremyr
barracuda.txt1.65 KBjeremyr
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

omega8cc’s picture

Project: Barracuda » Octopus
Component: Nginx Server » Nginx Configuration
Status: Active » Closed (works as designed)

You need to follow the how-to: http://drupalcode.org/project/octopus.git/blob/HEAD:/docs/HINTS.txt, and use location (within parent location, if possible) like:

location ^~ /someprefix {
  location ~* ^.+\.aspx$ {
    try_files $uri @cache;
  }
  try_files $uri @cache;
}
jeremyr’s picture

Thankyou. Incase this helps someone else: this is what I added to /data/disk/o1/config/server_master/nginx/post.d/nginx_vhost_include.conf

location ~* ^.+\.aspx$ {
    try_files $uri @cache;
  }