My friend's website did not notice that many product names were wrong when releasing the product, and the word of the keyword was wrong. And now the website is ranked. In addition, I found that many links correspond to the same page. What should I do? Naturally, it is 301 redirection. The problem is that it would be too troublesome to manually write commands. What else do you need to modify the statistics? The answer is a regular expression. But do not abuse it.
If you just want to remove the directory from the URL, because there is a URL with a directory and no directory in the website, but it actually corresponds to the same page, you only need a redirect command:
Redirect/service http://foo2.example.com/service
If a word is wrong in the URL, or the singular or plural is wrong. Then you need the redirectmatch command (replace ABC with xyz, the key is the confirmation of the regular expression, especially when the replaced target string and source string are sub-string relationships, what should I consider when writing a regular expression ):
Redirectmatch 301 (. *) ABC ([. |-] +) (. *) HTML $ http://www.abc.com $1 xyzs $2 $3 html