Gok*_*N K 5 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
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
如果我访问http://example.com/about,我会得到一个404 File Not Found
我正在为Drupal这样做.清洁网址指南:https://drupal.org/getting-started/clean-urls
使用 VirtualHost 可以解决该问题,但 HHVM 的服务器模块现已弃用,建议您使用 fastcgi 而不是 apache/nginx。我将为 VirtualHost 提供一个答案,但如果需要,可以使用 nginx 替代方案进行更新。
首先,确保您的 SourceRoot 正确:
Server {
Port = 9000
SourceRoot = /home/myuser/www
DefaultDocument = index.php
}
Run Code Online (Sandbox Code Playgroud)
现在,对于规则来说,这应该可行:
VirtualHost {
* {
Pattern = .*
RewriteRules {
* {
pattern = (.*)$
to = index.php/$1
qsa = true
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
如果您希望查询完全按照您的预期工作,请将内部模式替换为:
* {
pattern = /(.*)
to = index.php?q=$1
qsa = true
}
Run Code Online (Sandbox Code Playgroud)
我已经测试了这两个,它们工作得很好。如果您仍然遇到问题,则问题可能与您的设置有关。确保启用错误和访问日志记录。