redirecting without changing URL

后端 未结 2 899
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-24 05:48

i want to redirect domain domain1.com to domain2.com completely but without changing domain1.com URL. i thought i could do that with .htaccess but i found out that it is not po

2条回答
  •  醉话见心
    2021-01-24 06:18

    If both domains point at the same server then you can setup your apache config to point both domains at the same document root.

    NameVirtualHost *
    
    
    ServerName domain1.com
    DocumentRoot /www/mysite
    
    
    
    ServerName domain2.com
    DocumentRoot /www/mysite
    
    

    However, I would recommend domain2.com redirects (with a 302 redirect in the .htaccess) because it will improve your search engine optimisation, as both sites will be considered as one. So if a GoogleBot finds domain2.com as a link in another site, it will add it as a pagerank to domain1.com.

提交回复
热议问题