New — Sohay now answers WooCommerce product, policy & cart questions. See how →

Changing the Knowledge Base URL

Move the whole Knowledge Base to /docs/ or /help/ — and understand what that breaks before you do.

Sohay → KB Settings → Settings has a URL Base field. Set it to docs, help, support — whatever suits your site — and the index and every article move together.

/knowledge-base/getting-started/ becomes /docs/getting-started/.

Do this before you publish, not after

Changing the base breaks every old URL, and nothing redirects them.

That includes links a search engine has already indexed, links in emails you have sent, and links customers have bookmarked. If the Knowledge Base has been public long enough to be linked, add redirects before you move it — a redirection plugin will do.

The best time to choose the base is the day you install Sohay. The second best is before anyone links to it.

The category base

Category URL Base, just below, moves the category archives. It defaults to kb-category.

It has to be a base of its own. A value equal to the article base, or nested inside it, is refused — because /docs/category/x and an article at /docs/category are the same URL, and which one WordPress serves would depend on rule ordering rather than on anything you can see.

“Nested” means sharing a path segment. /docs/ and /documentation/ look similar and coexist perfectly well.

Bases that are refused

A base already claimed by something else is rejected with an explanation rather than quietly accepted. That covers:

  • One of your pages, or — under a %postname%-first permalink structure — one of your posts.
  • Another registered post type or taxonomy, from any plugin.
  • WordPress itself: category, author, tag, page, search, feed, embed and the rest, plus your own category and tag base settings.

If yours is refused, pick another, or move the page that is using it first.

You do not need to re-save permalinks

Sohay rebuilds the URL rules itself, on the request after you save. There is no need to visit Settings → Permalinks afterwards — the usual WordPress ritual does not apply here.

If URLs still 404 after a change, that is worth reporting rather than working around.

Doing it in code

Two filters, for sites that manage configuration in version control rather than in the admin:

add_filter( 'sohaychat_kb_slug', function () {
    return 'docs';
} );

sohaychat_kb_category_slug does the same for category archives. Extend the reserved-slug list with sohaychat_kb_reserved_slugs.

One caveat: the “the two bases must not overlap” rule is enforced when the settings form saves. A filter returning overlapping bases produces rules whose precedence depends on registration order, which is nobody’s idea of a good time. Keep them distinct yourself.

Where to go next

Restyling the Knowledge Base pages, and Overriding a Knowledge Base template for deeper changes.

Mithun B.
Mithun B.

More articles by Mithun B..

View all posts

Give your website an assistant that answers from your content

Grounded answers, a team inbox, and store-aware tools — free on WordPress.org.

Add Sohay — Free

Free plugin · You bring your OpenAI key · Works with any theme