Excluding/including SSL on specific pages Redirect rules

Enabling SSL for just one page, or excluding one page or url

Why SSL on one page?

If you don’t want to move to SSL entirely because you’re afraid to lose your ranking, don’t worry. If you redirect your site with 301 permanent redirects, this does not happen.

Sometimes your site gets a bit slower when on SSL. This might be especially noticeable when you have a lot of resources loading from external domains. Or your site might use a service that doesn’t support SSL. Trying to get that service to start supporting SSL would be the best solution of course. But if you’ve got your mind set on enabling SSL on just one page, you can.

The plugin solution: Really Simple SSL per page

To be able to offer a solution that supports this, I’ve developed a plugin that handles this for you. You’ll have to deactivate the free plugin, than install Really Simple SSL per page

The manual solution

Manually you could do it as described below. This won’t give you the mixed content fixer though.

Go to your ftp program, and look for the root of your website. Find the .htaccess file. Sometimes you have to enable the “show hidden files” option. Open the .htaccess file in a text editor.

Just add this above the WordPress redirect rules in your .htaccess file

Remember, if you are in a subdirectory (website/subsite) you have to add the subsite before the page.
 RewriteEngine on
 RewriteCond %{HTTPS} !=on [NC]
 RewriteCond $1 /your-page-on-ssl/
 RewriteRule ^(.*) https://%{HTTP_HOST}%/$1 [R=301, L]

If you change it to this:

RewriteCond %{REQUEST_URI} !/your-page-on-ssl/

The redirect will not take place on that url.

If your site is still redirecting, you might have to leave the homeurl and siteurl on http, using safe mode

Related Articles

4 Comments

  • Jon Dingman

    I tried using this and reversed it to enforce non-ssl, but it throws a 500 error.

    RewriteEngine on
    RewriteCond %{HTTPS} =on [NC]
    RewriteCond %{REQUEST_URI} /video/
    RewriteRule ^(.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301, L]

    Any thoughts?

    • Rogier Lankhorst

      I think that should work. Maybe google for some variations on this, there can be some differences between servers.

      • amycarolyn

        This gave me a 500 error as well on Linux/Apache. I did Google it, that’s how I ended up here. 🙂

        • Rogier Lankhorst

          I just tested it, it works fine. If you get errors with this, I suggest you remove some lines until it starts working. Simplifying often helps. For example you can remove the https condition, or change the rewrite rule to redirect to another page

          RewriteEngine on
          RewriteCond %{REQUEST_URI} /your-page/
          RewriteRule ^(.*) http://%{HTTP_HOST}/another-page/ [L]

Leave a Comment