apache url 重写问题

发布于 2024-09-13 10:52:49 字数 476 浏览 3 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

煮酒 2024-09-20 10:52:49

在文档根目录的 .htaccess 文件中尝试这些规则:

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]

第一个规则用于递归,第二个规则结束递归。

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.

深巷少女 2024-09-20 10:52:49

当然;类似的东西

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

会起作用,但无论你遵循谁的答案,你总是需要根据你的情况进行调整,所以你需要了解它是如何工作的。

http://httpd.apache.org/docs/2.2/rewrite/ rewrite_intro.html#regex,
http://httpd.apache.org/docs/2.2/mod/mod_rewrite。 html
http://civilolydnad.se/projects/rewriterule/ 这样的东西会给你带来很大的帮助。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文