Skip to:

permalinks with trailing slash

  • _ck_


    I can’t use multiviews so any rewrite gurus know how to make the full rewrite rules set deal with trailing backslashes?

    I’d like to allow it work either way (with or without the final slash)

Viewing 2 replies - 1 through 2 (of 2 total)

  • Sam Bauers


    You should ticket this in Trac, we should probably deal with this case better than we do.



    If it makes you feel any better, wordpress doesn’t deal with it well either.

    I have to trick it into enforcing trailing slashes like this:

    RewriteCond %{REQUEST_FILENAME} !-f
    # RewriteCond %{REQUEST_URI} !..+$
    RewriteCond %{REQUEST_URI} !/$
    RewriteRule (.*) $1/ [R=301,L,QSA]

    and that doesn’t even work half the time depending on what other htaccess trickery I’ve got going on

    But I notice if I have slugs turned on in bbpress, it will remove the trailing slash always. If I have slugs turned off, it won’t tolerate a trailing slash at all and will 404

    I did manage to get the topmost rss feed to tolerate slash or not using this obvious mod

    RewriteRule ^rss(/|)$ /forums/rss.php [L,QSA]

    One thing that is important to do in bbpress vs how it’s typically done in wordpress, is not re-use/re-load the bbpress core engine if there is a redirect (which doubles the mysql calls) but to try to do it through htaccess

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar