URL change, rewriterule regular expression

Source: Internet
Author: User
URL change, SOS rewriterule Regular expression
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. . htaccess Regular Expressions Rewriterule Bulk URL Redirection seo?url? Rewrite


------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
------Solution--------------------
Rewriteengine on
Rewritebase/
Rewritecond%{request_uri} p (\d+)
Rewriterule p (\d+) http://www.songhuala.com/-p-$1.html [r=permanent,l]
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.