Custom rewrite rule for directory mapping
-
I am trying to use the mod_rewrite functions (e.g. add_rewrite_rule) to create a custom rewrite rule. The situation is that I am using a plugin which insists on using a really ugly slug for its post types. (I don’t want to edit the plugin core files for obvious reasons.) So the slug is “uglyname_blah”, so that all URLs to those posts look like:
https://mywordpresssite.com/blog/uglyname/posttitle_etc/Since I can’t change the slug, what I’d like to do is set up some kind of rewrite rule that basically says, “if you receive an attempt to go to ‘prettyname’, interpret it as a call for ‘uglyname'”.
In other words, if you visit:
https://mywordpresssite.com/blog/prettyname/posttitle_etc/The WP site will silently serve you the page at:
https://mywordpresssite.com/blog/uglyname/posttitle_etc/Can this be done, at all, much less with the rewrite rule function? If so, how? I am bad at mod_rewrite so any practical pointers would be appreciated as well.
- The topic ‘Custom rewrite rule for directory mapping’ is closed to new replies.