EDIT: changed topic title to fit what I discovered to be the problem, thanks to the answers below
I’m getting a weird behaviour with permalinks on my migration work.
My problem is not the one about internal links not redirecting. I am just trying this by pasting URLs into my browser’s address bar.
These are the two redirects I mean to happen in my tests:
that’s a post redirect, should redirect to the second post like this:
that’s a topic redirect, should go to:
I know my normalizations are working fine. My regexp is
/(?:.*)(\/)(?<topicid>\d*.)-(.[^\/#\?]*)(?<parm>\?(\w*)[=](?<start>\d+))?(?:\/)?(\D+(\/)?)?(?<postid>\d+)?(?:\/)?/normalized.\k<topicid>.\k<postid>
And I check them in the rails
console:
irb(main):069:0> Permalink.normalize_url('https://community.suitecrm.com/languages/17978-why-two-italian-language-packs#16249')
=> "normalized.17978.16249"
irb(main):068:0> Permalink.normalize_url('https://community.suitecrm.com/languages/17978-why-two-italian-language-packs')
=> "normalized.17978."
That is what I intended. I have this in my Permalinks table:
And this is what it looks like from the database:
But when I put this into the browser URL
it gets redirected to
Instead of what it should be
So I see the first post, it doesn’t scroll to the second one as it should.
Why is that #16249
hash getting added back, if my normalization removed it?
Another way to expose this incongruence (although a bit artificially) is to try the following redirects from the browser’s address bar:
https://community.suitecrm.com/normalized.17978.
correctly redirects to:
Reports disappeared - 💬 General Discussion - SuiteCRM
And Why two Italian language packs? - #2 by roberto - Translation and Language Packs - SuiteCRM
correctly redirects to
Reports disappeared - #2 by erevodifosin - 💬 General Discussion - SuiteCRM
So why doesn’t it work when going through the normal process?