【问题标题】:CMSMS htaccess rewrite for ListIt2 moduleListIt2 模块的 CMSMS htaccess 重写
【发布时间】:2015-02-01 09:35:09
【问题描述】:

我正在使用 CMS 制作简单的 1.11.11 版创建网站,我使用 listit2 模块 1.4.1 版。

现在这个模块只能生成这种形式的url:
http://example.com/listit2/item-alias/page-id

现在,我不关心用于显示正确模板的页面 ID,
但由于这是一个多语言网站,我希望 listit2 出现在我的(虚拟)语言文件夹后面:
http://example.com/lang/listit2/item-alias/page-id

所以我在我的 htaccess 文件中添加了 2 行重写, 就在 CMSMS 的一般重写规则之前。

RewriteCond %{HTTP_HOST} ^lang/listit2 [NC] 重写规则 ^lang/listit2(.*)$ listit2$1 # 以/parent/child/的形式重写url # 但仅在请求的 URL 不是文件或目录时重写 RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.+)$ index.php?page=$1 [QSA]

但这似乎不起作用,因为它会生成摘要概述,而不是像来自 http://example.com/listit2/page-id 的内容那样的详细信息页面

如何解决?

【问题讨论】:

    标签: apache .htaccess mod-rewrite url-rewriting


    【解决方案1】:

    这就是诀窍

    重写引擎开启 RewriteBase / #listit2 的虚拟文件夹 RewriteRule ^lang/listit2(.*)$ index.php?page=listit2$1 RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.+)$ index.php?page=$1 [QSA]

    【讨论】:

      【解决方案2】:

      这不是 .htaccess 问题。这是 ListIt2 模块中的 URL 生成问题。

      在您的摘要模板中,您需要将自己的自定义 URL 放在 href 中,而不是使用标准变量作为 detail_url。

      例如这样的(此代码未经测试,请查看文档以了解实际变量)

      <a href="{root_url}/lang/listit2/{$item->item_alias}/{$content_id}" title="Read more about {$item->title}">Read More...</a>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-11-15
        • 1970-01-01
        • 1970-01-01
        • 2012-11-08
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多