Redirecting HTTPS to HTTP via .htaccess

前端 未结 1 432
遥遥无期
遥遥无期 2021-01-27 12:37

I\'m using a WordPress with its default .htaccess and I need to redirect all urls starting with https:// to http://. My server is using the same folder for http and https protoc

相关标签:
1条回答
  • 2021-01-27 13:17

    Change the order of the rules:

    Options +FollowSymlinks
    
    <IfModule mod_rewrite.c>
        RewriteEngine On
    
        RewriteCond %{SERVER_PORT} ^443$
        RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [R=301,L]
    
        # BEGIN WordPress
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule . /index.php [L]
        # END WordPress
    </IfModule>
    

    Otherwise the WordPress rule will catch all request that’s URL path is not empty (i.e. not just /).

    0 讨论(0)
提交回复
热议问题