79000

How to force http- NOT https using htaccess

Question:

I have ONE directory for my entire domain that I want to force https, which is "/docs". In the /docs folder, I have the following htaccess file:

RewriteEngine On RewriteCond %{HTTPS} !=on RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

This is forcing https to everything in the /docs directory, which is what I want it to do. The problem I am having is trying to force REMOVE https back to http for all other areas of my site. In the root folder of the site (which is running wordpress), I have the following htaccess file:

# BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress RewriteCond %{HTTPS} on RewriteCond %{REQUEST_URI} !^/docs/?.*$ RewriteRule ^(.*)$ http://www.mydomain.com/$1 [R=301,L]

Unfortunately, this is not working. I can still access other areas of my site over https.

What do I need to change to get this to work correctly?

Answer1:

Why do you need to revert back to http? If you have the proper SSL certificates you might as well keep your access secure. Unless you are concerned about the load on your system.

Answer2:

Since the accepted answer doesn't actually answer the question, I figured I'd post my solution to this. Add this to your .htaccess file to force HTTP instead of HTTPS:

# BEGIN Force HTTP RewriteEngine On RewriteCond %{SERVER_PORT} 443 RewriteRule ^(.*)$ http://yourdomain.com/$1 [R=301,L] # END Force HTTP

Answer3:

Try the Force non-SSL plugin for wordpress.

Answer4:

The "WordPress Force HTTP" plugin was the only thing that worked for me. It changes https to http for not just the front page like most of the answers out there, but also changes https to http for all sub-directories in your website.

<a href="https://en-au.wordpress.org/plugins/wp-force-http/" rel="nofollow">https://en-au.wordpress.org/plugins/wp-force-http/</a>

Recommend

  • dyanmic url not rewriting ht access
  • Create dynamic subdirectories using htaccess and php
  • Mod_rewrite: Include query string when redirecting
  • Creating Wordpress like shortcode in laravel blade
  • url rewrite not working .htaccess
  • Dynamic URL rewrite using .htaccess
  • Use htaccess to mask domain and folder name
  • .NET library for posting to a Blog
  • Replace Add To Wishlist text with Heart icon WooCommerce
  • .htaccess HTTPS Main Domain & Wildcard HTTP Sub-Domains + All Non-WWW
  • (Un)setting a cookie in mod_rewrite
  • Too many Redirects after switching WordPress to https
  • Accessing environment variables set using mod_rewrite in PHP
  • Wordpress Create Category AJAX Response
  • Can I used mod_rewrite to change file extensions? .jpeg to .jpg for example
  • htaccess will not rewrite subdomains
  • Wordpress and Drupal SSO/Single Sign On
  • wordpress query - next two events by metadata date
  • IIS 7.5 404 Error for .PDF files
  • Removing the .php file extension from the URL Request
  • During installation of Django, why do I keep getting ImportError: No module named django?
  • pillow imaging ImportError
  • JBoss External Properties Files in Classpath
  • htaccess add www if not subdomain, if subdomain remove www
  • How to run “Deployd” on port 80 instead of port 5000 in webserver.
  • All Classes Conforming to Protocol Inherit Default Implementation
  • Jenkins: How To Build multiple projects from a TFS repository?
  • ActionScript 2 vs ActionScript 3 performance
  • Websockets service method fails during R startup
  • How can I estimate amount of memory left with calling System.gc()?
  • Apache 2.4 - remove | delete | uninstall
  • Easiest way to encapsulate a HTML5 webpage into an android app?
  • Busy indicator not showing up in wpf window [duplicate]
  • costura.fody for a dll that references another dll
  • Observable and ngFor in Angular 2
  • How can i traverse a binary tree from right to left in java?
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • Conditional In-Line CSS for IE and Others?
  • java string with new operator and a literal