htaccess: redirect all requests to different domain (without query arguments)

后端 未结 2 770
悲&欢浪女
悲&欢浪女 2021-02-19 16:31

How can I redirect all requests (irrespective of what page is being requested) on sub.domain.com to newdomain.com? Currently I have

Redirect 301 / http://www.new         


        
相关标签:
2条回答
  • 2021-02-19 16:45
    RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com$
    RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]
    

    That will forward any GET requests.

    0 讨论(0)
  • 2021-02-19 16:59

    Use Rewrite:

    RewriteEngine on
    RewriteRule (.*) http://www.newdomain.com/ [R=301,L]
    
    0 讨论(0)
提交回复
热议问题