1

I've tested various snippets in order to achieve the following, but with no success. I don't want to set the whole site to HTTPS at the moment, only 2 specific pages:

.org.uk/directoryA/directoryB/

.org.uk/directoryC/directoryD/

The setup:

1 - WP-CONFIG.PHP:

define('FORCE_SSL_ADMIN', true);

2 - Root .HTACCESS file at Root, and in the file, placed at the top:

RewriteEngine On RewriteCond %{HTTPS} on RewriteRule !^wp-(admin/|login.php|includes/|content/)(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

What this does is: it redirects all to HTTP, except for WP-ADMIN, ETC.

But why? You might be thinking, since I already have it set in WP-CONFIG.PHP.

Well, Yoast SEO indexes HTTPS - and as I said, I don't want to provide a HTTPS website just yet. So this seemingly redundant RewriteRule forces Yoast SEO to index HTTP.

I wish to continue using this.

Also, I need to force HTTPS for the following two separate URLs, whilst ensuring the rest of the site is HTTP://.

.org.uk/directoryA/directoryB/

.org.uk/directoryC/directoryD/

How might I customize the above to force HTTPS:// as it currently does, and for allowing the above URLs to be forced as well?

1

This is a pointless question. you either do a sitewide HTTPS or just don't do it at all. Doing HTTPS for only some pages is just lying to yourself about the security of the site.

You can decide to have HTTPS for only some of your users, but you can never do it just on some of your pages without breaking the fundamental assumptions behind using HTTPS as a security measure.

If for some reason you need those pages HTTPS but just can't do the whole site, then put those pages under a different domain/subdomain.

  • I agree, 100%. It is. After posting this question, I regretted not setting the site to HTTPS from the very start. But I am in the process - but before I do, I have to test on staging (plugins, themes...), and deliver updates to the live at the same time. But, I wasn't asking for an opinion, I was asking for assistance. I've asked my question, shame the gold medalists seems to have become tired & jaded with "pointless" questions. – Dylan Oct 13 '15 at 10:12
  • Sorry, but I am not in the bushiness of assisting people to commit suicide. In any case the answers on this site are for people comming here from search engines. The fact that they are relevant for the people asking the actual question is a side effect. – Mark Kaplun Oct 13 '15 at 10:53
  • I am tired of people that ask for expert advice and when the advice is not what they want to hear they start arguing. I don't get it, if people think that they know better why do they ask, and if they don't like the advice why do they argue as if that will change the advice. HTTPS was designed to work only on a full site, therefor there is no point in testing on partial site as you should never have a real site deployed like that. – Mark Kaplun Oct 13 '15 at 12:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.