typo3-realurl icon indicating copy to clipboard operation
typo3-realurl copied to clipboard

Feature Suggestion: removable "slug" in fixedPostVars for extensions

Open ursbraem opened this issue 6 years ago • 4 comments

I'm investigating about "stackoverflow-style" URLs for a while. Now it ocurred to me that maybe this could be a sponsorable feature for RealUrl?

The basic idea is quite simple: instead of the human readable part being used to look up the record, a record's uid is provided in the URL. The human readable part (slug) is just an addition (for readability). It can be changed or left away. For the lookup, only the uid is being used. If the slug doesn't correspond to the real slug, a redirect occurs.

Here's an example for this behaviour

Basic info: https://stackoverflow.com/questions/39573477

Full current post URL https://stackoverflow.com/questions/39573477/extbase-not-found-exception-redirect-to-404-default-page

Old title, mistypes ect https://stackoverflow.com/questions/39573477/whatever

The config could be something like this: infixedPostVars

                    'lookUpTable' => array(
                        'table' => 'tx_myextension_domain_model_item',
                        'id_field' => 'uid',
                        'alias_field' => 'uid',
                        'additional_slug' => 'title', # <- that's imaginary

What do you think?

PS: Mathias Brodala is developing an extension that extends realURL for regular pages on https://github.com/pagemachine/typo3-flat-urls . I'm more concerned about "flat URLs" for extbase extensions than for pages, though.

ursbraem avatar Dec 22 '17 16:12 ursbraem

You can try making https://stackoverflow.com/questions/39573477-extbase-not-found-exception-redirect-to-404-default-page using mysql CONCAT function.

dmitryd avatar Jan 08 '18 15:01 dmitryd

Can it be that you are referring to this other issue #177 ?

Because https://stackoverflow.com/questions/39573477/extbase-not-found-exception-redirect-to-404-default-page seems to be about that story (that if you don't handle the 404 in your extension, extbase will just throw an error).

ursbraem avatar Jan 09 '18 10:01 ursbraem

No. You can use one GET value just one in postVars. So what you want to do is not doable out of the box. But With what I offered, it is possible.

dmitryd avatar Jan 11 '18 13:01 dmitryd

I don't understand, sorry

Let me just propose one simplification to the concept, which removes the redirect.

Post Uid=123

URL used in Links on Site www.example.com/path/to/posts/123/the-current-title-of-the-post

Working URLs www.example.com/path/to/posts/123/the-current-title-of-the-post www.example.com/path/to/posts/123 www.example.com/path/to/posts/123/an-old-title-of-the-post www.example.com/path/to/posts/123/any-mispeled-tile-of-the-pst

That would be sufficient for what I imagine. No redirect to the current full URL is necessary. The "slug" implies no GET value, it's just an additional information appended to the functional part of the URL.

Is that maybe feasible already?

ursbraem avatar Jan 15 '18 17:01 ursbraem