• Normally WP can automatically add a trailling slash on my url if I forgot typing in manually. But, Recently, I added some 301 redirects for buddypress slugs as following:

    RedirectMatch 301 ^/members/(.*)$ http://example.com/community/members/$1
    RedirectMatch 301 ^/groups/(.*)$ http://example.com/community/groups/$1
    RedirectMatch 301 ^/blogs/(.*)$ http://example.com/community/blogs/$1
    RedirectMatch 301 ^/forums/(.*)$ http://example.com/community/forums/$1

    After this redirects, if I type in any of the above 4 slugs without a trailling slash, WP doesn’t know to add it.
    How to let wp know to add trailling slashs to the 4 bp slugs without removing the redirects rules?

    Regards

Viewing 7 replies - 1 through 7 (of 7 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    Hrm.

    I’m not sure you can. The extra / is put up by WordPress. Checking on BuddyPress, if I go to http://explain.com/members/ipstenu (no / at the end) it doesn’t add on and I DON’T have any redirects going on. It should still work, though. Is it not?

    Thread Starter imjscn

    (@imjscn)

    yes, the / is added by WP, but since I made the 301, WP lost the ability to add the / on these 4 links.
    It takes lots of headache to sort out what’s happening. I will just go back to install BP on root blog and remove the 301.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    But those links aren’t WP links, is what I’m saying, I mean, yeah, they’re on a WP install, but the links are made by BuddyPress, and not the native WP stuff. If they were WordPress pages or posts, that would be a different thing.

    And I’m a bit surprised if you’re saying that the 301 redirect is breaking the links, since … I can put in those links on my site, in a root install, with no 301, and no trailing / and they work the same as with the trailing /

    Thread Starter imjscn

    (@imjscn)

    I sort of figured it out…
    My root blog wasn’t with BP default theme(that’s why I need 301 BP links to 2nd blog).
    After 301, links with / got redirected, because 301 ^/members/(.*)$ include all sub directory under this BP slug;
    Links without / got no place to go because they are pointing sub-directory and my root blog doesn’t provide that page.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    This sounds more like a misconfigured BP install, sadly.

    I can’t repro this sadly, so I’m stumped at why a 301 would fail, when http://example.com/members/foobar and http://example.com/members/foobar/ should BOTH work out of the box.

    Arguably, that means http://example.com/community/members/foobar and http://example.com/community/members/foobar/ should also both work without issues.

    Thread Starter imjscn

    (@imjscn)

    somehow I feel the problem is in this statement: 301 ^/members/(.*)$

    members/* works, it redirects entire members/ dir
    but members/(*) may not work, the / immediately followed by the (

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    I dug around my BP/WP install and I have this:

    RewriteRule ^(.*)/author/(.*)$ http://domain.com/members/$2/activity [L,R=301]

    Which works just fine.

    Try this? It’s a shot in the dark.

    RedirectMatch 301 ^/members(.*)$ http://example.com/community/members$1
    RedirectMatch 301 ^/groups(.*)$ http://example.com/community/groups$1
    RedirectMatch 301 ^/blogs(.*)$ http://example.com/community/blogs$1
    RedirectMatch 301 ^/forums(.*)$ http://example.com/community/forums$1
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Some trailling slash lost after some redirects’ is closed to new replies.