0

I'm working on an ancient (1989!) website which, back in the days, just showed a file directory in some cases. I want to use rewrites to show people a proper file instead.

Case: I have 3 folders, 01, 02 & 03. Each of these contains magazine pages, but no index file. Now I would like to redirect people going to /01/ to /01/0101.htm instead, (and /02/ to /02/0201.htm & /03/ to /03/0301.htm )

My knowledge of regex sucks/blows... I tried the following, but that doesn't work:

rewrite /01/ /01/0101.htm ;
rewrite /02/ /02/0201.htm ;
rewrite /03/ /03/0301.htm ;

What is the proper way to handle these redirects?

Evert
  • 162
  • 1
  • 3
  • 16
  • 2
    `(1989!)` Given that the first web browser was available internal at CERN in 1990 and only published in 1991, I somewhat doubt this number is correct :) – Sven Apr 27 '17 at 12:48
  • You're totally right :) The magazines on the site are from '89-'94, but I guess the site was made in later days. – Evert Jul 17 '17 at 22:26

1 Answers1

0

I propose the following:

Instead of a rewrite, just define an index per directory:

location /01 {
    index 0101.htm;
}
...
Sven
  • 98,649
  • 14
  • 180
  • 226