On Wed, 10 Jun 2015 08:15:46 GMT, Suliman wrote:

I mean that in my example part:

 void index(HTTPServerRequest req, HTTPServerResponse res)
 {
 	res.redirect("/index.html");
 }

do not work. It's redirect to index.html URL, but not open file (404 error).

What I should to add in this block of code to get it's open index page, that located in public folder.

It does work, it just doesn't do what you expected. You're asking it to redirect "/" to "/index.html" and it does that. But since you didn't provide any handler for "/index.html", it returns a 404.

Why don't you want to use serveStaticFile if youwant to do exactly what it does ?
You can look at the code here: https://github.com/rejectedsoftware/vibe.d/blob/d3fb879f1bd58e63f49c4693501974467f45f04a/source/vibe/http/fileserver.d#L114

Probably what you want is:

router.get("/", staticRedirect("/index.html")),
      .get("*", serveStaticFiles("public/"));

That will redirect "/" to "/index.html" (just like your handler), and serve content of files that are matching URL in "public/".

Note that it's serveStaticFiles (plural). That will allow you to serve the static content you want.
serveStaticFiles source: https://github.com/rejectedsoftware/vibe.d/blob/c9d47138b14570332920aeaf73621e038c6d5e93/source/vibe/http/fileserver.d#L28