N
N
Nikita Danilov2016-06-22 12:48:37
Apache HTTP Server
Nikita Danilov, 2016-06-22 12:48:37

How to redirect a URL with a colon?

Good afternoon!
The site (Joomla 3, Virtuemart 3) has links like alcopribor.ru/stati?catid=9&id=136:97-retsept-domashnej-nastojki-chaya-i-vanili-na-samogone
They need to be redirected to CNC links like alcopribor .ru/stati/recepts/97-retsept-domashnej-nastojki-chaya-i-vanili-na-samogone
CNC Artio in Joomla does not digest the original reference with a colon and a get-parameter; I'm trying to fix it through .htaccess, I made this rule:

RewriteCond %{QUERY_STRING} ^catid=9&id=136:97-retsept-domashnej-nastojki-chaya-i-vanili-na-samogone$
RewriteRule ^stati$ http://alcopribor.ru/stati/recepts/97-retsept-domashnej-nastojki-chaya-i-vanili-na-samogone? [R=301,L]

It worked fine on other URLs with get parameters, but it doesn't work on this one. I suspect that because of the colon in QUERY_STRING. Backslash escaping doesn't help. Replacing with %3A also doesn't work.
How to rewrite the redirect rule to make it work? Thanks in advance)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Никита Данилов, 2016-06-22
@NDanilov2015 Автор вопроса

Представляете, дело было не в двоеточии! Двоеточие достаточно заэкранировать обратным слэшэм, как я и думал. А вот чтобы реально начало работать, необходимо в RewriteRule вместо ^stati$ написать ^(.*)$.
Прошу объяснить мне, что же с этим Апачем неладно =)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question