将 en.example.com 重定向到 example.com/index.php?language=en
我想要将以下开头的地址重定向
en.example.com/somefile.php
到
example.com/somefile.php?language=en
:在lighttpd中使用mod_rewrite模块。直到现在我才明白:
$HTTP["host"] =~ "^en\.(.*)\.com$" {
url.rewrite-once = (
"^/(.*)"
=>
"/$1?language=en"
)
}
但这似乎不起作用。要做什么才能使这项工作有效?
I would like redirect addresses that start with:
en.example.com/somefile.php
to:
example.com/somefile.php?language=en
Using mod_rewrite module in lighttpd. Until now I got this:
$HTTP["host"] =~ "^en\.(.*)\.com$" {
url.rewrite-once = (
"^/(.*)"
=>
"/$1?language=en"
)
}
But this does not seem to be working. What to do to make this work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
试试这个:
Try this:
试试这个
这应该重写子域 en。和/或神父。到 URL 字符串完整的任何域(包括 TLD),并附加语言参数。
示例:
Try this
This should rewrite subdomains en. and/or fr. to whatever domain (including the TLD) with the URL string intact, and append the language parameter.
Examples:
尝试以下..如果它适合您..
$HTTP["host"] =~ "^en.([^.]+.com[a-z0-9-]+.php)$" {
url.rewrite-once = (
“^/(.*)”
=>
“/$1?语言=en”
)
}
try following.. if it works for you..
$HTTP["host"] =~ "^en.([^.]+.com[a-z0-9-]+.php)$" {
url.rewrite-once = (
"^/(.*)"
=>
"/$1?language=en"
)
}