我需要代理URL http://de.domain.com/article1/foobar/到http://de.foobar.domain.com/article1/ 。
我怎样才能获取和设置子域语言的一部分?
例子:
http://de.domain.com/article1/foobar/ => http://de.foobar.domain.com/article1/ http://dk.domain.com/article1/foobar/ => http://dk.foobar.domain.com/article1/ http://en.domain.com/article1/foobar/ => http://en.foobar.domain.com/article1/ http://el.domain.com/article1/foobar/ => http://el.foobar.domain.com/article1/
我听说这是不可能的只有mod_proxy和我必须使用mod_rewrite为此。 但我不知道如何。 也许有人可以发表一个例子?
redirect是不行的。
我的解决scheme
RewriteEngine On RewriteCond %{HTTP_HOST} ^([^.]+)\.domain.com RewriteRule ([a-zA-Z0-9]+)/([a-zA-Z0-9]+) http://%1.$2.domain.com/$1 [P,L]
请试试这个:
RewriteEngine On RewriteBase / RewriteRule ^(.*)/foobar/$ /$1