RewriteCond
RewriteRule
记录下现在我会的:
RewriteEngine On #RewriteRule ^(.*)/(.*)/$ index.php?m=index&c=$1&a=$2 [QSA] #RewriteRule ^(.*)/$ index.php?m=index&c=$1&a=index [QSA] # yhy:测试test RewriteRule ^test$ index.php?c=test [QSA] RewriteRule ^test/(.*)/$ index.php?c=test&a=$1 [QSA] RewriteRule ^test/(.*)/(.*)\.html$ index.php?c=test&a=$1&id=$2 [QSA] # yhy:finance RewriteRule ^Finance/$ index.php?c=finance [QSA] RewriteRule ^Finance/type-(\d+)\.html$ index.php?c=finance&a=type&leixing=$1 [QSA] RewriteRule ^Finance/(.*)\.html$ index.php?c=finance&a=detail&id=$1 [QSA] # RewriteRule ^Finance/type-(\d+)/&page=(\d*)$ index.php?c=finance&a=index&leixing=$1&page=$2 [QSA] url:
nginx.htaccess
每次改写好后要重新启动服务器
if (!-e $request_filename) { rewrite ^/login/$ /index.php?c=login last; rewrite ^/loginout/$ /index.php?c=loginout last; rewrite ^/regist/$ /index.php?c=regist last; rewrite ^/regist/(.*)/$ /index.php?c=regist&a=$1 last; rewrite ^/help/$ /index.php?c=help last; rewrite ^/finance/$ /index.php?c=finance last; rewrite ^/finance/login/(.*)\.html$ /index.php?c=center&a=login&id=$1 last; rewrite ^/finance/(.*)\.html$ /index.php?c=finance&a=info&id=$1 last; rewrite ^/safe/$ /index.php?c=safe last; rewrite ^/risk/$ /index.php?c=risk last; rewrite ^/lcc/$ /index.php?c=lcc last; rewrite ^/question/$ /index.php?c=question last; rewrite ^/guide/$ /index.php?c=guide last; rewrite ^/findpwd/$ /index.php?c=findpwd last; rewrite ^/findpwd/(.*)/$ /index.php?c=findpwd&a=$1 last; rewrite ^/center/$ /index.php?c=center last; #关于我们 rewrite ^/about/$ /index.php?c=about last; rewrite ^/about/(.*)/$ /index.php?c=about&a=$1 last; rewrite ^/about/(.*)/(.*)\.html$ /index.php?c=about&a=$1&id=$2 last; #处理一键绑定 rewrite ^/bangding/$ /index.php?c=binding last; rewrite ^/checkcustkey/$ /index.php?c=binding&a=checkcustkey last; #常见问题 rewrite ^/faq/$ /index.php?c=faq last; rewrite ^/faq/(.*)/$ /index.php?c=faq&a=$1 last; rewrite ^/faq/(.*)\.html$ /index.php?c=faq&id=$1 last; #P2P活动 rewrite ^/p2pactive/$ /index.php?c=p2pactive last; rewrite ^/p2pactive/page_(\d+)\.html$ /index.php?c=p2pactive&page=$1 last; rewrite ^/p2pactive/(.*)\.html$ /index.php?c=p2pactive&a=info&id=$1 last; #搜索c rewrite ^/type-(\d+)-(\d+)-(\d+)/$ /index.php?c=finance&a=index&tuijian=$1&shouyi=$2&qixian=$3 last; #短信 rewrite ^/msg/$ /index.php?c=msg last; #保单 rewrite ^/insurance/$ /index.php?c=insurance last; }