B
B
barkalov2014-08-24 21:56:02
Apache HTTP Server
barkalov, 2014-08-24 21:56:02

Rewrite, saving part of the URL to a variable that is visible in SSI. How to do it in Apache?

I know how easy it is to do everything on Nginx, but the patient is Apache. In general, everything is different. Please help.
It is necessary that requests of the form:

http://site.com/path/name00
http://site.com/path/name01
..
http://site.com/path/name98
http://site.com/path/name99
"redirected" (not "redirected", that is, without three hundredth codes, imperceptibly for the user) into something like:
site.com/path/names.shtml
In other words, into the same shtml template. Inside which I would like to have SSI and a variable with the value name ** (or at least with the entire address line before the "rewrite" in order to parse the value from there).
Or, speaking the language of nginx, you want:
location ~ /path/name(\d\d) {
    set $nameNum $1;
    rewrite * /path/names.shtml;
}
location /path/names.shtml {
    ssi on;
}
So that inside names.shtml you can do:
<!--#echo var="nameNum" -->and get the number.
.htaccess available. Help, friends. Writing an article.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question