简体   繁体   English

移动的网站现在需要将动态网址重定向到静态网址

[英]Moved website now need to redirect dynamic url to static url

I've recently moved my website from an old PHP script to Wordpress. 我最近将网站从旧的PHP脚本移到了Wordpress。 I'm trying to redirect my indexed links to the new WP formatted URL. 我正在尝试将索引链接重定向到新的WP格式的URL。 I am trying to make 我正在努力使

http://www.example.com/categoryResults.php?cat=1 http://www.example.com/categoryResults.php?cat=1

redirect to 重定向到

http://www.example.com/recipe-type/alligator/ http://www.example.com/recipe-type/alligator/

and of course I have a handful of other categories that will need to have rules created for them. 当然,我还有一些其他类别,需要为其创建规则。 I've found a few examples but they all seem to try and pass the 'cat' variable to the new URL. 我找到了一些示例,但它们似乎都试图将'cat'变量传递给新的URL。 Can someone tell me where to look for an example of how to accomplish the above? 有人可以告诉我在哪里寻找实现上述目标的示例吗?

For this particular example you can use this rule: 对于此特定示例,可以使用以下规则:

RewriteEngine On

RewriteCond %{THE_REQUEST} \s/+categoryResults\.php\?cat=1[&\s] [NC]
RewriteRule ^ /recipe-type/alligator/? [R=302,L]

Make sure this rule is before your other WP rewrite rules. 确保此规则在其他WP重写规则之前。

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

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