通过的.htaccess重定向HTTPS到HTTP重定向、htaccess、HTTP、HTTPS

由网友(醉酒湿红唇)分享简介:我用一个词preSS其默认的.htaccess,我需要重定向开始以https所有URL://到http://。我的服务器使用相同的文件夹,HTTP和HTTPS协议...这是我目前的.htaccess:I'm using a WordPress with its default .htaccess and I nee...

我用一个词preSS其默认的.htaccess,我需要重定向开始以https所有URL://到http://。我的服务器使用相同的文件夹,HTTP和HTTPS协议... 这是我目前的.htaccess:

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 protocols... this is my current .htaccess:

# BEGIN WordPress <IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase 
RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L] </IfModule> 
# END WordPress

Options +FollowSymlinks
RewriteEngine On
RewriteCond %{SERVER_PORT} ^443$
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [R=301,L]

它工作正常的 https://www.domain.com/ (重定向到的 http://www.domain.com/ 的),但它不与 https://www.domain.com/subpages/ (它也重定向到的 http://www.domain.com/ )。

It works fine for https://www.domain.com/ (redirects to http://www.domain.com/) but it doesn't work with https://www.domain.com/subpages/ (it also redirects to http://www.domain.com/).

你看到的任何问题,在.htaccess中吗?

Do you see any problem in .htaccess please?

感谢您

推荐答案

更​​改规则的顺序:

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>

否则的话preSS规则将捕获所有请求的URL路径不为空(即不只是 / )。

阅读全文

相关推荐

最新文章