简体   繁体   English

Apache重写规则x?y / z到x / w / z .htaccess

[英]Apache Rewrite Rule x?y/z into x/w/z .htaccess

I need to rewrite rule in htaccess. 我需要在htaccess中重写规则。 I can't understand how to rewrite this url: 我无法理解如何重写这个网址:

https://example.com/forumdisplay.php?125-Wiki-Encyclopedia/page2&order=desc https://example.com/forumdisplay.php?125-Wiki-Encyclopedia/page2&order=desc

into this: 进入这个:

https://example.com/wikipedia/page2&order=desc https://example.com/wikipedia/page2&order=desc

The part of the link - "page2&order=desc" in this link is changeable, it can be "page3" , "page10&order=desc" etc. 链接的一部分 - 此链接中的"page2&order=desc"是可更改的,它可以是"page10&order=desc" "page3""page10&order=desc"等。

I am trying to redirect link in .htacess. 我正在尝试重定向.htacess中的链接。 Smth like this: 像这样的Smth:

RewriteCond %{QUERY_STRING} ^f=125&page=(\d+)&order=(\w+)$
RewriteRule ^forumdisplay.php wikipedia?page=%1&order=%2 [R=301,L]

But in question is /page instead of &page . 但问题是/page而不是&page

You have many issues at your rules like f=125 which is 125 in menthioned URLs. 你在你的规则一样有很多问题, f=125这是125在menthioned网址。

Try This : 尝试这个 :

RewriteCond %{QUERY_STRING} ^125\-Wiki\-Encyclopedia\/page(\d+)&order=(\w+)$
RewriteRule ^forumdisplay.php  wikipedia/page=%1&order=%2? [R=301,L]

Note: clear browser cache and then test 注意:清除浏览器缓存然后测试

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM