MOD maj todo et page d'infos
[cl7.git] / urlrewrite / cl7_urlrewrite.erl
1 -module(cl7_urlrewrite).
2 -export([arg_rewrite/1]).
3
4 -include_lib("yaws/include/yaws_api.hrl").
5
6 arg_rewrite(Arg) ->
7 Req = Arg#arg.req,
8 {abs_path, Path} = Req#http_request.path,
9 NPath = {abs_path,
10 case string:rstr(Path, ".html") of
11 0 -> Path;
12 N -> "/?page=" ++ string:substr(Path, 2, N - 2) ++ string:substr(Path, N + 5)
13 end
14 },
15 % pour les tests
16 %{ok, F} = file:open("/tmp/out.txt", [write]),
17 %io:format(F, "~p~n", [Path]),
18 %file:close(F),
19 Arg#arg{req = Req#http_request{path = NPath}}.
20