简体   繁体   中英

Moved website now need to redirect dynamic url to static url

I've recently moved my website from an old PHP script to Wordpress. I'm trying to redirect my indexed links to the new WP formatted URL. I am trying to make

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

redirect to

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. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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