htaccess redirect only if domain matches

后端 未结 2 1919
我在风中等你
我在风中等你 2021-02-08 11:35

I have a problem where I need to redirect my domain before it hits php. By the time it hits the ability to execute a header, it is too late.

How can I do



        
2条回答
  •  灰色年华
    2021-02-08 12:11

    Using mod_rewrite

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
    RewriteRule ^(.*)$ http://www.domain.com/$1 [R,L]
    

提交回复
热议问题