url rewriting – How to add a custom redirect rule for Post as subdomains?

Question

I am trying to write a custom redirect rule to open a download matching pages.

Example: postname.example.com/download
Example2: postname.es.example.com/download

I am using the following code in my functions.php:

add_rewrite_rule('^([^/]+)\.example\.com/download?$','index.php?pagename=download&postnames=$matches[1]','top');
add_rewrite_rule('^([^/]+)\es.example\.com/download?$','index.php?language=es&pagename=download&postnames=$matches[1]','top');

I’ve also added wildcard forwarding for all subdomains from my DNS and verified.
but these rule not work can please help me out how open my download page like this

0
How Seek 6 months 2022-03-05T02:02:51-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse