How to dynamically redirect www-based URLs to non-www URLs with multiple domains in same VirtualHost

后端 未结 3 930
轮回少年
轮回少年 2021-02-06 06:39

I\'ve got a VirtualHost that looks something like:



  ServerName  domain1.com
  ServerAlias www.domain1.com domain2.com www.domain2.com
         


        
3条回答
  •  野的像风
    2021-02-06 07:40

    No need for rewrites.

    
        ServerName domain1.com
        ServerAlias domain2.com
        ... real vhost settings ...
    
    
    
        ServerName www.domain1.com
        Redirect permanent / http://domain1.com/
    
    
        ServerName www.domain2.com
        Redirect permanent / http://domain2.com/
    
    

提交回复
热议问题