URL change, RewriteRule regular expression

Source: Internet
Author: User
The website address changed. for help, the RewriteRule regular expression was changed because the previous website address was not properly configured. However, I did not expect that Baidu submitted and deleted the website for a long time. now it is still the previous website address, in order not to affect customer access, we want to batch redirect old URLs to new URLs. the old format is as follows: http://www.songhuala.com/p1099/ /c.
Because the previous web site felt that it was not standard enough, so I adjusted the URL again, but I did not expect that Baidu submitted and deleted the Web site for a long time. now it is still included in the previous web site, in order not to affect customer access, now I want to batch redirect old URLs to new URLs,
The old format is as follows: http://www.songhuala.com/p1099/beijing gift /china_flowers_info.html
New format: http://www.songhuala.com/-p-1099.html

I made the following redirection in. htaccess,

RewriteEngine on
RewriteCond % {REQUEST_URI} ^ p/d + \/. * \/China_flowers_info \. html $
RewriteRule ^ (. *) $ ^-p-/d + \. html $1 [R = 301, L]

However, the correct new URL cannot be targeted. I hope my friends can help me to test this regular expression for one afternoon. Thank you for your patience. Grateful. . Htaccess regular expression RewriteRule batch URL redirection seo? Url? Rewrite
------ Solution --------------------
RewriteCond % {REQUEST_URI} ^ p/d + \/. * \/China_flowers_info \. html $
RewriteRule ^ (. *) $ ^-p-/d + \. html $1 [R = 301, L]

The marked red part seems to be incorrect.
------ Solution --------------------
RewriteEngine On
RewriteBase/
RewriteCond % {REQUEST_URI} p (\ d +)
RewriteRule p (\ d +) http://www.songhuala.com/-p-00001.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.