dou5454954610 2014-01-28 18:27
浏览 63
已采纳

用表单提交重写动态网址

I want to rewrite a dynamic url coming from submit form:

this is the code of form submit:

the correspond url is: mondomain/search.php?id_ac=23

i want to rewrite this to mondomain/23

any help please.

  • 写回答

1条回答 默认 最新

  • dsndm82062 2014-01-28 18:28
    关注

    You can use:

    RewriteCond %{THE_REQUEST} \s/+search\.php\?id_ac=([^&]+)&id_de=([^\s&]+) [NC]
    RewriteRule ^ /%1-%2? [R=302,L]
    
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^([^-]+)-([^/]+)/?$ /search.php?id_ac=$1&id_de=$2 [L,QSA,NC]
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?