Appending a slug to the URL in a SEO friendly way

Hello everyone,

On our CMS, all our database objects and CMS pages are accessible in the URL with an ID and come without slug:

www.mywebsite.com/ID540/

For each custom page we create, there is a field to enter a slug, but unfortunately I am not able to use that field to generate a user-friendly URL, like so:

www.mywebsite.com/ID540/my-slug-is-cool

I am not able to access anything else but the View part and create various page templates and utilities, so I am stuck with Twig and with the variables the developers create for us.

The problem: on any page, I never see the slug, always the ID. Also, anyone that creates a link with any slug after the ID is a valid link on our CMS:

  • if original slug is “my-slug-is-cool”, link should be /id540/my-slug-is-cool
  • anyone creating a link on that ID can put any slug: /id540/this-thing-is-bad, and the page will happily give a 200 OK answer…

Possible solution: I was thinking about using Javascript on each page to append to the URL the correct slug, without a page refresh, or replace it with the correct one, triggering a 301 and a refresh.

Firstly, is it seen as good or bad by SEO? Secondly, what’s the best implementation? I was thinking about using window.location.href

Thank you for your help :slight_smile:

What’s a “slug”?

:thinking:

A mollusc with no shell.

This is what modrewrite in .htaccess is for.
This probably belongs in server config.

Well, if it was my development environment, I would have configured everything nicely and probably redone the whole thing, but I don’t have any access to the nginx configuration files nor the inner code of the CMS (enterprise CMS), based on Symfony.

The developers argue that it would take another slow request to the DB to get that slug, and they need authorization to implement such functionnality from another organisation that ordered that CMS and from which we depend on.

So, my last “hope” was javascript controlling the urls, but that doesn’t seem too good :frowning:

And how do you call those shell-less molluscs that go in the url? /post/5/another-mollusc? :smiley:

1 Like

Slugs. (I think Sam was just being flippant. )

@ronpat: https://en.wikipedia.org/wiki/Slug_(web_publishing)

3 Likes

Thanks, @TechnoBear. I’ve never heard that expression before. I would have never figured it out :tongue:

@SamA74, how do you convince the mollusk to crawl into the coin slot of a vending machine?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.