【问题标题】:LogLevel rewrite does not logLogLevel 重写不记录
【发布时间】:2026-01-26 09:15:01
【问题描述】:

我正在尝试在 xampp 上的 joomla 网站中调试重写。我观察到的是以下内容

  1. 网站正在运行
  2. 在 Joomla BE 中启用 URL 重写 后,所有链接都不起作用,但主页仍然有效。我得出结论,重写工作不正常。
  3. 我已在根目录中激活(重命名).htaccess
  4. 我已将 LogLevel warn rewrite:trace6 添加到 httpd.conf 并重新启动 Apache。

我咨询过http://httpd.apache.org/docs/2.4/mod/mod_rewrite.html#logginghttp://docs.joomla.org/Enabling_Search_Engine_Friendly_(SEF)_URLs

不确定这是否相关,但我的网站配置为:

<VirtualHost *:80>
 UseCanonicalName Off
 VirtualDocumentRoot "D:/srv/htdocs/%2/%1"
 ServerAlias *.*.localhost
</VirtualHost>

在 httpd-vhosts.conf 中,使我能够拥有多个网站

但即使我将其配置为非虚拟主机,它仍然不会在 error_log 和 access_log 中创建用于重写的日志条目。

【问题讨论】:

    标签: apache mod-rewrite joomla url-rewriting virtual-hosts


    【解决方案1】:

    我还在使用 Apache 2.4.17 在 WAMP 上运行虚拟主机,这是我在 httpd-vhosts.conf 文件中的配置,以便获得正确的日志文件:

    <VirtualHost *:80>
        RewriteEngine On
        LogLevel alert rewrite:trace6
        ErrorLog "C:\Users\.....\Desktop\log.txt"
        ServerName .....
        DocumentRoot ....
        <Directory  ....>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Require local
        </Directory>
    </VirtualHost>
    

    希望这会有所帮助。

    【讨论】:

      【解决方案2】:

      尝试 alert 而不是 warn 进行调试。即:LogLevel alert rewrite:trace6 此外,当您查看日志文件时,可能没有刷新它。还要检查您是否正在查看正确的日志文件。在 Apache 配置文件中搜索“ErrorLog”。

      【讨论】: