Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If you put this in your .htaccess file

Options MultiViews

and you have these files

stuff/
    howto.html
    index.php
    items.php

then all of these web addresses work

/stuff/           # brings up /stuff/index.php.
                  # Yes, this would have worked
                 `# even without MultiViews

/stuff/howto      # brings up /stuff/howto.html.
                  #`This would not have
                  # worked without MultiViews,
                  # although you could have done
                  # it with a Rewrite rule, too

/stuff/items      # brings up /stuff/items.php

/stuff/items/1234 # brings up /stuff/items.php,
                  # and sets $_SERVER['PATH_INFO']
                  # to '/1234'

/stuff/items/2010/03/01/how-to-plant-a-garden
                  # brings up /stuff/items.php, and
                  # sets $_SERVER['PATH_INFO']
                  # to '/2010/03/01/how-to-plant-a-garden'.
                  # If my file layout was different,
                  # like /stuff/items/2010.php,
                  # then it would have brought up
                  # 2010.php, and given it the PATH_INFO
                  # string of '/03/01/how-to-plant-a-garden'
                  # So it seems Apache searches the string
                  # from right to left for a file

Putting MultiViews in the .htaccess file is much shorter than using Rewrite rules.

But now I am looking at nginx, and I have yet to find the equivalent. It doesn't have to be so short. I know try_files would take care of the ones without PATH_INFO strings. But for the ones with PATH_INFO, the only way I've found is a Rewrite rule for each PHP file, especially the ones that take slashes in PATH_INFO.

share|improve this question

migrated from stackoverflow.com Jun 7 '11 at 9:21

This question came from our site for professional and enthusiast programmers.

1  
I don't think so, NGINX is built for performance and MultiViews is a BIG performance hit, it should definitely NOT be used on a production website. It's also worth noting that if you're using MultiViews Google won't index your site properly (See gerd-riesselmann.net/archives/2005/04/…) – sam Jun 7 '11 at 20:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.