.htaccess 在YAMS中找不到404页

.htaccess 在YAMS中找不到404页,.htaccess,http-status-code-404,modx,.htaccess,Http Status Code 404,Modx,我需要一些帮助。我正在使用带有YAMS模块的MODx,该模块用于多语言。我遵循YAMS的安装和设置文档,但仍然没有找到404页 我想得到: localhost/sub/en/index.php?id=1 localhost/sub/fr/index.php?id=1 localhost/sub/th/index.php?id=1 原始链接是 localhost/sub/index.php?id=1 这是htaccess文件中的重写规则。我在“服务器配置”选项卡中从YAMS获得了重写规则 我正试图

我需要一些帮助。我正在使用带有YAMS模块的MODx,该模块用于多语言。我遵循YAMS的安装和设置文档,但仍然没有找到404页

我想得到:

localhost/sub/en/index.php?id=1

localhost/sub/fr/index.php?id=1

localhost/sub/th/index.php?id=1

原始链接是

localhost/sub/index.php?id=1

这是htaccess文件中的重写规则。我在“服务器配置”选项卡中从YAMS获得了重写规则

我正试图到处寻找所有的解决方案。还是不走运。请建议或指出我做错了什么


提前感谢

如果你在前端获得localhost/en/index.php?id=1这样的链接,你必须用“sub”填充“MODx Subdirectory”字段。您可以在Modules->Yams->Other Params中找到它,实际上问题是.htaccess文件。我从YAMS复制所有.htaccess并替换整个原始.htaccess文件。为了解决我的问题,我只复制了友好的URL部分,并在原始的.htaccess文件中只替换了这个部分

以下是我从YAMS复制并在.htaccess文件中替换的内容:

# Redirect from mydomain.com/rootname to mydomain.com/rootname/
RewriteRule ^en$ en/ [R=301,L]
RewriteRule ^fr$ fr/ [R=301,L]
RewriteRule ^th$ th/ [R=301,L]

# The Friendly URLs part
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^th/(.*)$ index.php?q=$1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^fr/(.*)$ index.php?q=$1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^en/(.*)$ index.php?q=$1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

非常感谢您的建议。

是否将
/sub/en
重定向到
/sub/en/
?通过在htaccess文件中添加一些随机文本来检查htaccess是否启用,并查看是否会得到一个500错误页面?通常YAMS会在域名后直接添加/en/,因此您会得到www.example.com/en/sub/
# Redirect from mydomain.com/rootname to mydomain.com/rootname/
RewriteRule ^en$ en/ [R=301,L]
RewriteRule ^fr$ fr/ [R=301,L]
RewriteRule ^th$ th/ [R=301,L]

# The Friendly URLs part
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^th/(.*)$ index.php?q=$1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^fr/(.*)$ index.php?q=$1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^en/(.*)$ index.php?q=$1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]