Closed ADoebeling closed 6 years ago
I agree. If source
of the news entry is not default
, its URL should respond with a 301
status code redirecting to the configured location. I see this more as a feature than a bug fix though.
if (null === $objArticle)
{
throw new PageNotFoundException('Page not found: ' . \Environment::get('uri'));
}
+ if ('default' !== $objArticle->source && substr($objArticle->url, 0, 7) !== 'mailto:')
+ {
+ throw new RedirectResponseException($this->generateNewsUrl($objArticle), 301);
+ }
$arrArticle = $this->parseArticle($objArticle);
$this->Template->articles = $arrArticle;
// edit: may be a 302
code is more suitable though
What about mailto:
links? The problem still exists for them.
May be respond with a 404
in this case?
That's a very good idea. We should even do this if the external URL is not a mailto:
link, shouldn't we? Because an external news or event does no longer have an internal URL.
Hm, so you mean responding with a 404
in general, if $objArticle->source !== 'default'
? You are right, may be that is the more correct solution anyway. A 301
redirect for a URL that points to a news article which has an external link would not be correct in the sense of: the page/content did not actually "move permanently" to the new URL. It is simply an invalid URL.
Changed in ce44f810acef008016028643ad20aaaf0c2adb56.
If you create a news-record with an external redirect, the newslist is linking the entry to the external ressource.
The previously generated alias-url of the news-entry doesn't redirect you. The old url is still available and shows a
1
to the screen:AFAIK this is a bug as the page-module is handeling this case correctly.