WordPress SSL Redirection with One Sub-Folder Exception

Sorry to ask such a total newbie question – I’m struggling with an exception to our SSL redirection rules on our WordPress site. Basically, everything is redirecting as http to https.

Feedburner doesn’t support https feeds (grr!) so I’m hoping to create an exception to prevent requests for http://domain.co.uk/feed/ being redirected to https://domain.co.uk/feed/

Read More

Our redirect rules in .htaccess look a little like this:

RewriteEngine On 
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]

Any and all help really, really appreciated. Thanks!

Related posts

Leave a Reply

1 comment

  1. Try

    RewriteEngine On 
    RewriteCond %{SERVER_PORT} 80 
    #exclude /feed/
    RewriteCond %{REQUEST_URI} !^/feed/ [NC] 
    RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
    
    #This section is optional
    RewriteCond %{HTTPS} on
    #send any cached https /feed/ back to http
    RewriteCond %{REQUEST_URI} ^/feed/ [NC] 
    RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
    

    If you previously visited the /feed/ URL and were redirected, this redirect will be cached in your browser. To test that it works correctly after changing the rule, change to private browsing, or clear you browser cache.

    If you think that existing clients have the same problem i.e. a cached https redirect to /feed/ you can include the optional section to send them back to http