D
D
Dmitry Glazkov2021-02-24 17:38:04
URL Handling
Dmitry Glazkov, 2021-02-24 17:38:04

How to correctly set up redirects from the old site from the subdirectory?

Good afternoon!
Such a task.
There was a site on WP - urls were uploaded .html (but only for pages, not for products)
Now a new site on ocstore - all urls - without .html
The old site is in the directory /old/
Plus, the url of the products has changed. There was /product/sumka-temno-sinyaya-s191/ (now it's /old/product/sumka-temno-sinyaya-s191/) and now it's /product-category/sumka-love-moschino
And one more thing.. ocstore makes duplicates.
The product is available both at /product-category/sumka-love-moschino and at /product-category/aksessuary2/sumka-love-moschino i.e. subheading is added.

As you can see, there are many questions.
But I feel that all solutions are nearby. in htaccess settings
1. It is necessary that everything is redirected from the old site from the /old directory to the new ones, without .html where it was
2. Remove duplicates so that the product is available only at /product-category/sumka-love-moschino
3. And in addition remove /?route=common/home from the main (when clicking on the logo)

Thanks in advance.
Oct Store 2.3.0.2.3

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2021-03-02
@dbglazkov

Two sites and two .htaccess files

/.htaccess
/old/.htaccess

The request /old/product/ryukzak-srednij-love-moschino/will be processed by the rules from the file /old/.htaccess
RewriteRule ^old/product/(.+)$ /$1 [L,R=301]
. In this form, the rule will not work.
How mod_rewrite actually works
The first RewriteRule is passed the path from where the .htaccess is to the requested file.

So /old/.htaccess will be passed to product/ryukzak-srednij-love-moschino/
RewriteRule
RewriteRule ^product/(.+)$ /$1 [L,R=301]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question