L
L
LIAL2015-02-22 23:59:00
Apache HTTP Server
LIAL, 2015-02-22 23:59:00

How to make such a redirect using htaccess?

Good day to everyone, help me solve this problem.
When setting the URLs on the site, an error was made: for example site.com/catalog/prodAct, but it was necessary to prodUct because
the site was indexed, I want to make 301 from the wrong URLs to the correct ones, the problem is that I not strong in the .htaccess syntax and after the product may or may not be the remaining parts of the path, those urls may look like this:
site.com/catalog/product
site.com/catalog/product/apple
site.com/catalog/product/apple /iphone
site.com/catalog/product/htc
site.com/catalog/product?search
and so on, there can be many variations.
How can I "bite" out of the middle of the prodAct url, change it to prodUct ? The parts to the left and right of the product are the same, it was a syntax error that was made, not a change in the url format Thanks
in advance to everyone who helps

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
IceJOKER, 2015-02-23
@IceJOKER

RewriteRule ^(.*?)prodact(.*?) $1product$2 [R=301]something like this, maybe someone will write a better version)

RewriteRule ^catalog/prodact(.*?) /catalog/product$1 [R=301]
// well, another option)

S
ShamblerR, 2015-02-24
@ShamblerR

For good it would be like this:
RewriteRule ^catalog/prodact(.*?) /catalog/product$1?&%{QUERY_STRING} [R=301]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question