日期:2014-05-17  浏览次数:20751 次

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]