Because before the Web site feel inadequate specification, so re-adjust the URL, but did not think, Baidu submitted delete URL for a long time, now included or the previous URL, in order not to affect customer access, now want to put the old URL batch redirect to the new URL,
The old format is as follows: http://www.songhuala.com/p1099/Beijing gift/china_flowers_info.html
The new format is as follows: http://www.songhuala.com/-p-1099.html
I did the following redirects in. htaccess,
Rewriteengine on
Rewritecond%{request_uri} ^p/d+\/.*\/china_flowers_info\.html$
Rewriterule ^ (. *) $ ^-p-/d+\.html$1 [r=301,l]
But how can not be directed to the correct new URL, I hope friends can help pointing, I test an afternoon, or did not change the regular expression. Please crossing to enlighten you. Appreciate.
Reply to discussion (solution)
Rewritecond%{request_uri} ^p/d+\/.*\/china_flowers_info\.html$
Rewriterule ^ (. *) $ ^-p-/d+\.html$1 [r=301,l]
The red part seems to be wrong
Rewriteengine on
Rewritebase/
Rewritecond%{request_uri} p (\d+)
Rewriterule p (\d+) http://www.songhuala.com/-p-$1.html [r=permanent,l]
Yesterday was very anxious, has not replied, today to see everyone reply is really very grateful.
After the introduction by asking a friend, asked idreamsoft.com dead wood, solved,
Here's what you can do to complete the redirect.
Rewriteengine on
Rewriterule ^ (. *)? P (\d+). *?\.html$-p-$2\.html [r=301,l]
Rewritecond%{request_uri} ^p/d+\/.*\/china_flowers_info\.html$
Rewriterule ^ (. *) $ ^-p-/d+\.html$1 [r=301,l]
The red part seems to be wrong
Yes, indeed, just learned, anxious also did not pay attention to,, later asked people also found wrong.
Rewriteengine on
Rewritebase/
Rewritecond%{request_uri} p (\d+)
Rewriterule p (\d+) http://www.songhuala.com/-p-$1.html [r=permanent,l]
Well, I think I should be able to, because it's done, I didn't test it. But also let me know that there is such a way of writing.