0

The codebase I have is full of files like "foo.en.html", that should be served when "foo.html" is accessed. I know the files are supposed to be "foo.html.en", but I want to avoid a mass rename if possible.

To clarify, we have files on the server that work fine:

Request:

GET /dummy/path/foo.en.html
foo.en.html HTTP/1.1
Host: 192.168.59.103:8080
Connection: keep-alive
...

Response:

HTTP/1.1 200 OK
Date: Thu, 14 May 2015 20:22:25 GMT
Server: Apache/2.4.7 (Ubuntu)
Accept-Ranges: bytes
Content-Length: 4521
...

What needs to work, but doesn't: (Making this request return HTTP 200 with the same content is a correct answer to this question)

Request:

GET /dummy/path/foo.html HTTP/1.1
Host: 192.168.59.103:8080
Connection: keep-alive
...

Response:

HTTP/1.1 404 Not Found
Date: Thu, 14 May 2015 20:17:13 GMT
Server: Apache/2.4.7 (Ubuntu)
Content-Length: 323
Keep-Alive: timeout=5, max=100
...
d8uv
  • 101
  • 1
  • 7
  • I also don't want to have to rewrite all the links that point to "foo.html" to go to "foo". If I need to do a bulk action, renaming the files is going to be far less error prone. But I still want to see if I can avoid any bulk actions. – d8uv May 06 '15 at 15:18
  • This is not a comment and should be added to the question or removed – 030 May 13 '15 at 15:53
  • What did you try? – 030 May 13 '15 at 15:53
  • Maybe it's time to review your codebase ? – krisFR May 14 '15 at 00:38
  • I tried a lot of things, nearly every option I could find in the Apache documentation for this. The environment I'm testing on is a very recent and very clean Ubuntu VM machine. Production is... not clean at all, but it works, but I haven't been able to find out why, given hours of looking through every log and config file I could find. I can give any configuration details for my current setup. – d8uv May 14 '15 at 14:17
  • Use a rewrite rule to make the incoming URL plain `foo`? – Brian May 14 '15 at 15:51
  • Please add a table that contains input and expected output and please notify me using the annotation sign (@username) – 030 May 14 '15 at 16:22
  • @Brian If you have a rewrite rule that would serve foo.en.html when foo.html is requested, that could definitely work! – d8uv May 14 '15 at 18:28
  • @185140777 I'm not sure a table would be too helpful... The files on the file system all have file names like "foo.en.html" and "bar.en.html". They need to be able to be served when URLs like "foo.html" and "bar.html" are requested. – d8uv May 14 '15 at 18:30
  • @d8uv It would clarify the question in my opinion. Please also add the attempts and current outcomes. – 030 May 14 '15 at 18:33
  • @18514077 I added examples in the question – d8uv May 14 '15 at 20:25
  • @Brian I just included an example of how things should go – d8uv May 14 '15 at 20:26
  • rewrite to `foo` then let apache worry about finding a file to serve. Look at the documentation link you posted - `foo` is a valid link for ANY of the files with one or more extensions in different orders. – Brian May 14 '15 at 21:37

0 Answers0