• Hi all,

    Like many of you, I’ve used Redirection a lot. It’s very nice to just say

    /someurl 301 => https://anyurl.com

    However it keeps these redirects globally for every subsite.

    There’s about 2,8xx plugins that come up in search and after losing track of how many pages I went through, I can see this isn’t a common thing. Most are redirects after specific events like login/out, first visit, etc.

    If anyone has a plugin that can do this on WP MultiSite on a per-subsite level, I’d really love to know.

    Thanks in advance!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter omii

    (@omii)

    Just noting, I added a faux shortcode-esque way for them to add a redirect in a pages content “for now”. The load on the server is manageable. Right now they just create a new page, customize the page URL and set the content as:

    [redirect url=”https://…”%5D

    I am hooking to pre_get_posts and look at the query->queried_object->post_content (if it exists) to see if that string is in there and if so use a regexp to pull out the URL to header(‘Location: …’); via HTTP/1.1 301 Moved Permanently. It works, for now.

    This is terribly inefficient. At least only WP loads and not the gobs of theme libraries as this hook fires before that but there has to be some better/deeper way to do this at the server level (apache .htaccess, etc).

    I’m not terribly confident I can make a plugin to that extent because there’s a multitude of customizations inside those .htaccess files by admins and other plugins.

    Are there any plugins that are masters of the apache/nginx/etc configs or WP Core that have a better suggestion for letting clients easily set up custom URLs with redirects? Redirection was nice because it put all the redirects right in a single place rather than making a new page just for a redirect. There must be, and always is, a better way ??

    Thanks for any tips!

    Moderator bcworkz

    (@bcworkz)

    As it is said, “The devil is in the details.” The best approach would depend on exactly what redirects you are trying to accomplish. Most concerning to me is “letting clients easily set up custom URLs with redirects.” Letting clients do anything that affects the operation of the site rarely ends well in my experience. There’s always exceptions of course.

    Typically, the best way to handle redirects is through .htaccess. Of course, you do not want clients toying with this file! You need some sort of interface that accepts client input, then verifies and validates input as correct before altering .htaccess. The “multitude of customizations” should not be a huge concern. You can demarcate your own section with comments much like WP does with insert_with_markers(). Anything outside remains unchanged. Whether there’s nothing else outside or hundreds of lines makes little difference.

    Thread Starter omii

    (@omii)

    Thanks and I agree with the same amount of murphy’s law attention. Clients is the wrong term, users would be better, and they’re all developers.

    I have a lot to read up on regarding anything like .htaccess. I did see comment-esque delimiters and had hoped there was a conventional way to add markup around areas of code so changes could be made in a controlled area. Thanks for confirming that so it doesn’t seem entirely impossible.

    Then again consider the situation where the system has 50,000 redirects. It’s a ridiculous situation but I always need to think of the extremes. Is .htaccess, or anything really going to handle request well at that point.

    Redirection was so nice, played well with apache/nginx/etc, allowed WP Core or .htaccess redirects, groups redirects into easy bundles, has a 404 manager, etc. It’s everything that’s needed, minus a coder that’s considering wp_* is not the only site..

    If anyone else has a plugin they know handles this already please shout it out!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘WP MultiSite – Allow a SUBsite custom 301 URL redirects, any plugins?’ is closed to new replies.