【问题标题】:AEM Dispatcher vhost settings with rewrite rule is not working具有重写规则的 AEM Dispatcher 虚拟主机设置不起作用
【发布时间】:2015-11-11 23:54:03
【问题描述】:

我无法在 AEM 的 Dispatcher 模块上进行重写。 以下是我的配置发生的情况:

调度程序配置:

我的 httpd.conf 片段

LoadModule dispatcher_module modules/mod_dispatcher.so

    <IfModule disp_apache2.c>
      DispatcherConfig conf/dispatcher.any
      DispatcherLog    logs/dispatcher.log
      DispatcherLogLevel 3
      DispatcherNoServerHeader 0
      DispatcherDeclineRoot 0
      DispatcherUseProcessedURL 0
      DispatcherPassError 0
    </IfModule>


    <VirtualHost *:80>
      ServerName mobile.example.com.au
      DocumentRoot "/var/www/html/content/mobile"
      RewriteEngine  on
      RewriteRule    ^/(.*)\.html$  /content/mobile/$1.html [PT]
    <Directory "/var/www/html/content/mobile">
      <IfModule disp_apache2.c>
        SetHandler dispatcher-handler
        ModMimeUsePathInfo On
    </IfModule>
      Options FollowSymLinks
      AllowOverride None
     # AddType text/html .html
     # AddOutputFilter INCLUDES .html
     # Options +Includes
    </Directory>

    </VirtualHost>

    ......

现在,如果我尝试访问 mobile.example.com.au/home.html,它会显示这个 404 并说没有内容:

找不到

请求的 URL /content/mobile/home.html 是 在此服务器上找不到。

虽然我可以使用完整路径直接点击页面: http://mobile.example.com.au/content/mobile/home.html 并呈现页面。

我在这里缺少什么?它与文档根目录有关吗?

另外,我们如何设置 mobile.example.com.au 的默认登录页面以显示 home.html。

【问题讨论】:

    标签: apache content-management-system aem dispatcher


    【解决方案1】:

    您能否检查重写日志以了解请求是如何流动的? 另外,要设置默认登录页面,您可以使用以下规则

    RewriteRule ^/$ /content/mobile/home.html [PT,L]
    

    【讨论】:

    • 另外,请检查您是否在 httpd conf 中启用了重写模块 :)
    【解决方案2】:

    我认为您需要更改此行:

    DispatcherUseProcessedURL 0

    DispatcherUseProcessedURL 1

    ...以便 Dispatcher 使用重写后的 URL 进行过滤器检查、缓存结构和对 AEM 的请求。您还需要按照 Mohit 的建议添加 RewriteRule,这可能是第一条规则 - 但前提是您希望 / 显示 /home.html 页面。

    另请参阅:Adobe documentation on Dispatcher configuration

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-05-16
      • 2020-02-15
      • 1970-01-01
      • 2012-12-13
      • 2018-07-04
      • 2017-05-15
      相关资源
      最近更新 更多