Apache: Redirect domain to other domain with appen

2019-09-09 19:51发布

I want example.se to redirect to example.com?lang=swe

It works fine with this apache config:

<VirtualHost *:80>
    ServerName example.se
    ServerAlias *.example.se
    Redirect permanent / http://example.com/?lang=swe
</VirtualHost>

The problem is that this breaks if there is something else after the domain, ex: example.se/page1 should redirect to example.com/page1?lang=1 but with the setup above it redirects to example.com?lang=swepage1.

Is there a way to do this right?

1条回答
在下西门庆
2楼-- · 2019-09-09 20:38

I believe it should be something close to this:

RedirectMatch permanent ^/(.+)$ http://example.com/$1?lang=swe

查看更多
登录 后发表回答