In .htaccess, redirect all domains except one

前端 未结 2 1914
温柔的废话
温柔的废话 2020-12-17 15:41

I have multiple domains on my server. I want to redirect all of them to one (example.net).

My .htaccess:

RewriteEngine on 
RewriteRule ^(.*)$ http://         


        
2条回答
  •  感情败类
    2020-12-17 16:19

    Just small note: Thanks goes to TRiG, but I had to remove one slash to make it work correctly (coz it added two slashes after domain name). This works for me:

    RewriteEngine on 
    Rewritecond %{HTTP_HOST} !^www\.example\.net
    RewriteRule ^(.*)$ http://www.example.net$1 [R=301,L]
    

提交回复
热议问题