Please help me modify the regular code. it cannot be completely matched.-php Tutorial

Source: Internet
Author: User
Please help me modify the regular code. it cannot completely match 1. requirement: process the addresses in all href on the webpage and place them back in the original place. because the css address is also the beginning of href and http, you need to set & lt; a matches (the URL may be in the form of www.qq.com or www. qq. comsdfsd. php? Id10 & amp; dsfsdsf and so on). please help me modify the regular code below, but it cannot be completely matched.
1. requirement: process all the addresses in the href = "" in the web page and then back to the original place, because the css address is also the beginning of href and http, so you need to http://www.qq.com this form, could it be a http://www.qq.com/sdfsd.php? Id = 10 & dsfs = dsf and so on), my code below, the http://ygtc.tmall.com can match, but the http://phny.tmall.com is not, after analysis found that the following URL

$ Con = file_get_contents ("http://phny.tmall.com"); // or $ con = file_get_contents ("http://ygtc.tmall.com ");
$ Con = preg_replace_callback ('/(echo $ con;

Function url ($ url ){
Return $ url [1]. '#'; // This is a simple example. it is actually more complex than this example.
}


2. for a pseudo-static rule, demand: access to the http://www.abc.com/taobao/phny/ or http://www.abc.com/phny/ are switched to show. php \? Domain = $1. if the URL contains an images string, this rule is not matched.

The code I wrote is as follows, but it does not work.

RewriteRule ([a-zA-Z\d=]+)/?$ show.php\?domain=$1


------ Solution --------------------
If so
The http://www.abc.com/taobao to the http://www.abc.com/show.php? Domain = taobao
The http://www.abc.com/taobao/phny to the http://www.abc.com/show.php? Domain = taobao/phny

It can be used in this way (the path does not include. jump)
RewriteEngine on
RewriteRule ^ [^ \.] + $/show. php? A = $0 [R, 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.