Apache重定向查询字符串

时间:2016-05-18 13:37:26

标签: apache mod-rewrite

我是构建反向代理apache的新手。

我有一个像这样的查询字符串:

  • host.example.com/some/thing/?company=string with spaces l.t.d。

我想让它看起来像:

  • host.example.com/some/thing/string with spaces l.t.d。

我写过:

RewriteCond %{QUERY_STRING]} ^company=(.*)$
RewriteRule ^/some/thing$ /some/thing/%1 [NC,L,R=301]

但RewriteCond和RewriteRule都不起作用。

任何帮助都非常感激。

由于

1 个答案:

答案 0 :(得分:0)

您实际上未与%{QUERY_STRING}变量匹配,请从变量中删除]

尝试:

RewriteCond %{QUERY_STRING} ^company=(.*)$
RewriteRule ^/?some/thing$ /some/thing/%1? [NC,L,R=301]