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 a200 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