mod_rewrite and double slash issue

前端 未结 5 977
半阙折子戏
半阙折子戏 2020-12-28 17:56

I applied the following mod_rewrite rule in Apache2 to redirect from non www to www:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^exa         


        
5条回答
  •  孤城傲影
    2020-12-28 18:14

    Fixed with:

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

    because $1 by default contains the index path /

提交回复
热议问题