使用extbase处理404错误

use*_*ser 1 typo3 realurl extbase

随着extbase我开发了一个扩展.然后我使用Realurl进行网址重写.

问题是,例如,我执行这个网址:www.mysite.com/records/record-number-one/一切都很好,因为"记录号码1"确实存在.

现在,如果我尝试

www.mysite.com/records/record-numbbbbbbber-one/

我收到了这个错误

Exception while property mapping at property path "":The identity
property "record-numbbbbbbber-one" is no UID.
Run Code Online (Sandbox Code Playgroud)

但我想重定向到404页面,而不是得到这个错误!

我尝试在我的操作中验证记录并重定向到404页面,但是当我收到此错误时,我的代码(在我的操作中)甚至没有被执行!

经过大量搜索,有人说如果我设置了

plugin.myplugin.mvc.throwPageNotFoundExceptionIfActionCantBeResolved = 1
Run Code Online (Sandbox Code Playgroud)

或者干脆

config.tx_extbase.mvc.throwPageNotFoundExceptionIfActionCantBeResolved = 1
Run Code Online (Sandbox Code Playgroud)

错误将被解决,我尝试了两个,我仍然得到错误.

任何帮助?

谢谢

PS:我使用的是TYPO3 6.1.7

小智 5

通过添加'enable404forInvalidAlias'=> 1在realurl配置中修复此问题

例如:

'lookUpTable' => array(
'table' => 'tx_example_domain_model_example',
'id_field' => 'uid',
'alias_field' => 'title',
'addWhereClause' => ' AND NOT deleted AND NOT hidden',
'enable404forInvalidAlias' => 1,
),
Run Code Online (Sandbox Code Playgroud)