apache url rewrite problem

2019-09-06 07:36发布

2条回答
我命由我不由天
2楼-- · 2019-09-06 08:09

Certainly; something like

^(.*)\?(search)=(.+)&(rows)=(.+)&(page)=(.+)$ $1/$2/$3/$4/$5/$6/$7

will work, but no matter whose answer you follow, you'll always need to tweak it to your situation, so you need to understand how it works.

http://httpd.apache.org/docs/2.2/rewrite/rewrite_intro.html#regex, http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html and something like http://civilolydnad.se/projects/rewriterule/ will get you a long way.

查看更多
倾城 Initia
3楼-- · 2019-09-06 08:16

Try these rules in the .htaccess file in your document root directory:

RewriteRule ^problem/getproblems/fieldset/2/([^/]+)/([^/]+)/(.+)$ /problem/getproblems/fieldset/2/$3?$1=$2 [N,QSA]
RewriteRule ^problem/getproblems/fieldset/2/([^/]+)/([^/]+)$ problem/getproblems/fieldset/2?$1=$2 [L,QSA]

The first rule is for the recursion and the second rule ends the recursion.

查看更多
登录 后发表回答