Help make a redirect that would work like this:

When you click on the link vyyda http://site.ru/novosti/{переменная1}/{переменная2}/ subperemenno11// Peremenmenny2 [uk] should be relocated to http://site.ru/novosti/{переменная1}/{переменная2}.html sub peremennaya1 [uk] / peremenmena2 [b] .html

    2 answers 2

    Apache Module mod_alias

     RedirectMatch "^/novosti/([^/]*)/([^/]*)/$" "http://site.ru/novosti/$1/$2.html" 
    • put in after RewriteEngine On but does not work ( - Alexey Vasilyev
    • is mod_alias connected? - Nikola Tesla
    • figured out, it would be right like this: RedirectMatch 301 ^/novosti/(.*)/(.*)/$ http://site.ru/novosti/$1/$2.html - Alexey Vasilyev
    • Removed in the response from the first parameter of the site address. - Nikola Tesla
    • one more incomprehensibility if you need to do a redirection from http://site.ru/novosti/{переменная1}/{переменная2} sub / variable2 http://site.ru/novosti/{переменная1}/{переменная2} without a slash at the end, I used the following code: RedirectMatch ^/novosti/([^/]*)/([^/]*)$ /novosti/$1/$2.html but the result surprised me and I don’t know how to overcome it, it turned out that I have a lot of .html.html.html in the address bar, how did I solve it? - Alexey Vasilyev

    Redirect /index.html http://example.com/newdirectory/

    Substitute your values ​​here.

    Approximately - so:

    Redirect http://site.ru/novosti/ {variable1} / {variable2} / http://site.ru/novosti/ {variable1} / {variable2} .html

    • I need to do it by mask, more than 22000 elements, which is why the variables were written - Alexey Vasilyev
    • Then I do not know, sorry) - Niklex