How to redirect from site/ynivalniki to site/complekty

 RewriteRule old-catalog /(.*) / old-catalog /$1 [R=301,L] 

did not work

  • did not understand well but maybe you want RewriteRule ^ynivalniki/(.*)$ /complekty/$1 [R=301,L] - splash58

2 answers 2

Option 1

 redirect /ynivalniki /complekty 

This will be a redirect with a status of 302 Fround (temporary) and without mod_rewrite .

Option 2

Using mod_rewrite (which is a bit strange in this case, since regular expressions are not needed here).

 RewriteEngine On RewriteCond %{REQUEST_URI} ^/ynivalniki(.*)$ [NC] RewriteRule ^ynivalniki(.*)$ /complekty$1 [L,R=301] 

In this case, the redirect will be permanent - 301 Moved Permanently . If you need 302, I think you will find where to change;)

UPD

Both options will redirect entire sections. That is, the link /ynivalniki/aaa?bbb=ccc will redirect to /complekty/aaa?bbb=ccc

If you only need this one URL, then you can:

 RewriteEngine On RewriteCond %{REQUEST_URI} ^/ynivalniki(/)?$ [NC] RewriteRule ^(.*)$ /complekty/ [L,R=301] 

And please learn to use search. There are so many answers to the same question.

  • You have a small error: /ynivalniki2 redirected to /complekty2 , which may be unnecessary. - user194374
  • @kff is not a mistake, so planned - korytoff

You can do this, for example, (using mod_rewrite ):

 RewriteEngine On RewriteBase / RewriteRule ^ynivalniki(\/.*)?$ /complekty$1 [L,R=301,NC] 

Unlike the solution proposed by @korytoff, the condition is written more compactly.