Answer the question
In order to leave comments, you need to log in
How to write Redirect rules in .htaccess for files in nested directories?
Situation: there was an old site. Approximately 50 links to his various pages "settled" on the forums. Launched a new site with a new name and a different structure. For the old domain name, a one-page site was created - a stub.
Task: is it possible to write such redirects in the root .htaccess of the old site so that without creating a real directory structure, redirect requests to the old addresses to the necessary pages of the new site?
Example:
Actually, what doesn't work: the forum has a link like site.ru/ru/products/e1-access/ and clicks on it. It is necessary to navigate through it to redirect to site2.ru/catalog/226/
Tried to create a line in the root .htaccess
Redirect 301 /ru/products/e1-access/ http://site2.ru/catalog/226/
, but that's not how the redirect works. You have to create the /catalog/226/ directory and place your .htaccess with the lineRedirect 301 /ru/products/e1-access/ http://site2.ru/catalog/226/
. Answer the question
In order to leave comments, you need to log in
Well, for starters,
Redirect 301 doesn't work with regular expressions.
Solution 1: read here klondike-studio.ru/blog/vse_pro_hosting/301-redire...
I have described the main snippets for SEO redirects here. Your case is below.
Solution 2: lazy! https://donatstudios.com/RewriteRule_Generator
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question