Home >Backend Development >PHP Tutorial > rewrite 规则求解,

rewrite 规则求解,

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 13:34:45823browse

rewrite 规则求解,在线等…………
/sell_list.php 重定向到 /sell
/sell_list.php?fid=1 重定向到 /sell/list?fid=1
/bencandy.php?fid-55-id-21619-page-1.htm 重定向到 /news/bencandy.php?fid=55&id=21619

求高手帮忙,我自己写了好多次都不对。。

------解决方案--------------------

PHP code

RewriteEngine on

#http://www.aa.com/webapp/sell_list.php?fid=111222
RewriteCond %{QUERY_STRING} ^fid=([0-9]+)
RewriteRule ^sell_list\.php$   sell/list [L]
#http://www.aa.com/webapp/sell_list.php
RewriteRule ^sell_list\.php$  sell [L]
#http://www.aa.com/webapp/bencandy.php?fid-55-id-21619-page-1.htm
RewriteCond %{QUERY_STRING} ^fid-([0-9]+)-id-([0-9]+)-page-1\.htm
RewriteRule ^bencandy\.php(.*)$ news/bencandy.php?fid=%1&id=%2  [L] <div class="clear">
                 
              
              
        
            </div>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn