1
votes

Our mail list provider asked me to force the rss feed not to be https instead simple http.

Our site is running on Wordpress 4.7.1 and uses Easy HTTPS Redirection and SSL Insecure Content Fixer plugins to make site work.

Some people told me maybe I should add some exceptions for the .htaccess but I can't find in the forums how.

I have founded this thread but I couldn't understand It properly. htaccess force ssl except for rss feeds

This is what I found in my .htaccess file

# BEGIN HTTPS Redirection Plugin
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
# END HTTPS Redirection Plugin

Thanks for the help. Gergo

2

2 Answers

1
votes

You need to use template redirect hook.

add_action( 'template_redirect', 'template_redirect', 1 );

function template_redirect() {

    if ( is_ssl() && ! is_admin() ) {

        if ( 0 === strpos( $_SERVER['REQUEST_URI'], 'your_url' ) ) {

            wp_redirect( preg_replace( '|^https://|', 'http://', $_SERVER['REQUEST_URI'] ), 301 );
            exit();

        }

    }

}

Please paste your URL inside the your_url parameter.

0
votes

You can use this:

RewriteEngine On

#Check to see if HTTPs is not on, turn it on.
RewriteCond %{HTTP:X-Forwarded-SSL} !on
RewriteCond %{REQUEST_URI} ^\/(foobar)
RewriteRule (.*) https://%{HTTP_HOST}/$1 [L,R=301]

#If HTTPs is on, turn it off for foobar.
RewriteCond %{HTTP:X-Forwarded-SSL} =on
RewriteCond %{REQUEST_URI} !^\/(foobar)
RewriteRule (.*) http://%{HTTP_HOST}/$1 [L,R=301]

Change foobar to the relevant directory. Make sure you clear your cache before testing this.