Redirect HHVM-重写干净URL的规则

Redirect HHVM-重写干净URL的规则,redirect,drupal-7,hhvm,Redirect,Drupal 7,Hhvm,我有这样的链接-http://example.com/index.php?q=about我想让它们看起来像这样-http://example.com/about 目前我正在使用重写规则 VirtualHost { * { Pattern = .* RewriteRules { dirindex { pattern = (.*)/$ to = index.php/$1 qsa = true } }

我有这样的链接-
http://example.com/index.php?q=about
我想让它们看起来像这样-
http://example.com/about

目前我正在使用重写规则

VirtualHost {
  * {
    Pattern = .*
    RewriteRules {
      dirindex {
        pattern = (.*)/$
        to = index.php/$1
        qsa = true
      }
    }
  }
}
如果我访问,我会发现
404文件未找到


我这样做是为了Drupal。清洁URL的指导原则:

这个问题可以通过VirtualHost解决,但是HHVM的服务器模块现在已经贬值,我们鼓励您在apache/nginx上使用fastcgi。我将给出VirtualHost的答案,但如果需要,可以使用nginx替代方案进行更新

首先,确保您的SourceRoot是正确的:

Server {
  Port = 9000
  SourceRoot = /home/myuser/www
  DefaultDocument = index.php
}
现在,对于规则来说,这可能会起作用:

VirtualHost {
  * {
    Pattern = .*
    RewriteRules {
      * {
        pattern = (.*)$
        to = index.php/$1
        qsa = true
      }
    }
  }
}
如果希望查询完全按照预期工作,请将内部模式替换为:

* {
pattern = /(.*)
to = index.php?q=$1
qsa = true
}

我已经测试了这两个,它们工作得很好。如果您仍然面临问题,则该问题可能与您的设置有关。确保启用。

我已经为这个问题写了一个答案(我已经手动测试了自己,并且可以正常工作)。如果它解决了您的问题,请选择它作为答案,如果没有,请进一步解释您的问题。