Redirect all urls exactly, just change domain name

前端 未结 3 698
野性不改
野性不改 2021-01-01 19:15

I have a website with roughly 1K URLs. The website is moving to a different domain name. The URLs will be the exact same though, otherwise. I\'d like to incorporate an htacc

3条回答
  •  醉梦人生
    2021-01-01 19:21

    Place this rule in your DOCUMENT_ROOT/.htaccess file of domain.com:

    RewriteEngine On
    
    RewriteCond %{HTTP_HOST} ^(?:www\.)domain\.com$ [NC]
    RewriteRule ^ http://newdomain.com%{REQUEST_URI} [L,R=301]
    

提交回复
热议问题