301 redirect

前端 未结 3 1228
傲寒
傲寒 2021-01-23 09:46
  1. How do i redirect a url to domain . eg. http://www.mydomain.com/index.php=HairThing --> http://www.mydomain.com

  2. How do i redir

3条回答
  •  醉梦人生
    2021-01-23 10:17

    you could use a general rule that works on every domain without having to change the name of the domain all the time. This is very helpful when you have multiple domains parked on same root.

    RewriteCond %{HTTP_HOST}    !^www\.[a-z0-9-]+\.[a-z]{2,6}   [NC]
    RewriteCond %{HTTP_HOST}    ([a-z0-9-]+\.[a-z]{2,6})$       [NC]
    RewriteRule (.*)            http://www.%1/$1                [L,R=301]
    

提交回复
热议问题