• I am using WP Multisite with about 10 subdomain installs. I love it. What I need to find is the simplest way to redirect ALL pages that follow a key work to another domain. Similar to URL Mod Rewrite in function.

    So,
    phantomhearts.dmgstories.com/interactive/cabbot

    is redirected to
    bf.dmgstories.com/phantom-hearts/cabbot

    I will already know that everything is phantom-hearts. So I need to capture the uri following interactive/ and attach it to the url bf.dmgstories.com/phantom-hearts and simply redirect it. The keyword (cabbot) will always be one uri segment.

    More examples for clarity
    phantomhearts.dmgstories.com/interactive/anadell -> bf.dmgstories.com/phantom-hearts-anadell

    I have created several plugins, so I can do the code. I’m just not sure the best way to approach this. Where do I hook into?

    Thank you a lot!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Is this only going to be for one subdomain (e.g. always phantomhearts.dmgstories.com => bf.dmgstories.com/phantom-hearts/ and never somethingelse.dmgstories.com => bf.dmgstories.com/something-else/)?

    If so, I’d recommend forgoing a plugin and just using a rule in your .htaccess file that checks the host and URI path and redirects appropriately from there. This way you’re not using a PHP process just for a redirect (especially if it isn’t dynamic).

    If this isn’t the case, please let me know and I’ll recommend something for a plugin.

    Thread Starter chrismichaels84

    (@chrismichaels84)

    Yeah, its just for the one subdomain. Really, I’m fixing my short sightedness when I first created the system by moving it. In anycase, I thought about .htaccess, but I didn’t know I could redirect, only rewrite urls. I’ll look into that. Thanks!

    No problem. I don’t have time right now to figure out the exact combination of RewriteCond statements, but this answer on StackOverflow should point you in the right direction. Of particular interest is probably the latter part of the answer where he addresses the single subdomain issue.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Redirect all urls beginning with a keywork (custom post type?)’ is closed to new replies.