【问题标题】:ModX Can't Switch ContextsModX 无法切换上下文
【发布时间】:2015-10-14 21:47:50
【问题描述】:

我有一个需要翻译成三种外语的网站。我通过 System -> Contexts 创建了一个新的上下文,然后为 base_url、site_url 和 http_host 创建了上下文设置。但是,当我在新上下文中转到主页时,它会从初始上下文路由到 File Not Found Resource。有什么想法我可能遗漏/做错了吗?

谢谢

编辑:这是我的 .htaccess 文件中未注释的行

RewriteEngine On
RewriteBase /

RewriteCond %{HTTPS} on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

(a lot of rewrite rules from an older version of the site that used .aspx files. None of them match with the URLs on the website)

# Add 'www' to the HTTP_HOST for all domains except seasidehotelshawaii.com
# this will also preserve the query string.
RewriteCond %{HTTP_HOST} !^(.*)[this_is_the_main_domain].com$
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

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

我对 .htaccess 文件了解不多,但这就是其中的内容。 this_is_the_main_domain.com 是三个子站点的父站点。我正在尝试为每个子站点创建三个上下文。

【问题讨论】:

  • 你对你的 .htaccess 做了什么?
  • @SeanKimball 请看我的编辑
  • 您是否编辑过您的索引文件?

标签: modx modx-evolution


【解决方案1】:

您必须对您的 htaccess 文件进行一些相当广泛的更改。我猜你也没有写上下文切换插件?

按照这些教程进行操作:

http://www.multilingual-modx.com/blog/2011/multilingual-websites-with-modx-and-babel.html

http://www.multilingual-modx.com/blog/2011/seo-friendly-multilingual-websites-with-modx-and-babel.html

基本上,你没有给 modx 一个改变上下文的方法,也没有给它一个正确生成你的 url 的方法。

【讨论】:

    【解决方案2】:

    尝试使用XRoutingContextRouter 插件将您的域路由到正确的上下文。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-04-07
      • 2011-07-23
      • 1970-01-01
      • 2013-04-21
      • 2017-06-13
      相关资源
      最近更新 更多