Redirect “http://old.net/category/postname” to “https://new.com/postname”?

Since your new URLs do not have any category/ in them, you can redirect every URL that contains this and follows a pattern to your new permalink structure. <IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^category/(.+)$ https://www.example.com/$1 [R=301,L] </IfModule> Change example.com to your new website’s domain. You can also tweak with the 301 status if you wish. … Read more

Redirect old domain with query paramaters

The old domain is: www.example.com/newspage.asp?m=4&y=2015 and I need that URL, as well as that URL with different query paramaters to go to: example.com/news. So, you are also changing the host with this redirect (www subdomain to bare domain)? Otherwise, it just looks like you can ignore the query string. This is relatively trivial to do … Read more

How do I apply friendly URL permalinks to a custom WordPress template?

Add the following code In your main hooks file (maybe in functions.php) add_action(‘init’, ‘my_custom_rewrite_rules’); Then add this function function my_custom_rewrite_rules() { // The rule // Input: archives/publications/countries/kenya // Output: archive-template.php?posttype=publications&taxo=countries&slug=kenya add_rewrite_rule(‘archives/publications/countries/([^/]+)/’, ‘archive-template.php?posttype=publications&taxo=countries&slug=$matches[1]’, ‘top’); // Flush the rules (to activate them) flush_rewrite_rules(); } To learn more about regex and rewrite rules, those links might help https://regexone.com/ … Read more