84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
比如http://www.baidu.com/dd/index.php/rs/sol这个url需要实现隐藏index.php,基于nginx服务器。如何实现?网上很多帖子试过都不行。现在想知道怎么匹配出题目中的参数。
闭关修行中......
如果只是想提取的话,可以用这个正则:
(?<=dd)/.*
但是如果是为了在nginx上用,做地址的rewrite的话,应该这么写:
rewrite ^/dd/(.*)$ /$1 permanent;
/^http://www.baidu.com/dd(.+)$/
location / { if ($request_filename ~ "favicon\.ico$") { break; } if ( -e $request_filename ) { break; } if ( !-e $request_filename ) { rewrite ^.*$ /index.php last; } }
不用正则多好,直接explode('index.php','http://www.baidu.com/dd/index.php/rs/sol');
如果只是想提取的话,可以用这个正则:
但是如果是为了在nginx上用,做地址的rewrite的话,应该这么写:
不用正则多好,直接explode('index.php','http://www.baidu.com/dd/index.php/rs/sol');