PressTigers

How to Force SSL on Specific Pages of WordPress

SSL stands for “Secure Socket Layer” and is used to secure your web pages. If its status is active in your web application then your browser will redirect your website to secure the connection for security purpose. SSL activated applications contain data in encrypted form.

This SSL may be integrated into your payment modules, for login purposes or whatever other reason contingent upon your application. It can be activated by writing a script in your web application. In WordPress, it can be activated through a filter named as “force_ssl”. If you want to allow SSL then this filter will automatically enforce SSL on your complete WordPress website. Your website will then redirect you to HTTPS connection.

If you want to allow SSL on specific WordPress pages then use the following code in your Child Theme or in functions.php file of your Theme:

User Comments

3 thoughts on “How to Force SSL on Specific Pages of WordPress

    Margie says:

    This bit of code does NOT work – it actually locked me out of my admin completely. Thankfully I had a backup of my functions file to upload and overwrite. Don’t use!

      Hi Margie,

      We have rechecked that code at our side and its working fine. There might be some issue while placing that code or the conflict of the hook at your end. Or maybe you have not changed the page id’s at your end(mentioned in the code).

      Regards,

      Abdullah | WP Plugin Developer
      Email: support@presstigers.com

    Harish says:

    Sorry but what is reason for certain page only? because SSL important for SEO now guys, I’m using the plugin too it good for redirects….. https://wordpress.org/plugins/force-https-littlebizzy/

Leave a Reply

Your email address will not be published. Required fields are marked *

Get in Touch