Yes, I understand this continues to be requested 1000 occasions before... this is actually the difference...

I discovered this answer on StackOverflow to include the "world wide web" here: use htaccess to include world wide web with https support

RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Which is the most amazing and elegant solution I've ever seen:

  • It really works
  • It does not have to be transformed for use for any specific domain
  • It addresses both HTTP and HTTPS connections
  • Its only 3 lines

So, my real question is simple. Can someone assist me to adapt this code to operate within the other direction? (To get rid of the World wide web from websites and address all the things mentioned above)?

In my opinion that between your above (and hopefully below) solutions, we'll possess the world wide web rewrite to rule all of them!

RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%2://%1%{REQUEST_URI} [L,R=301]

Obtained from the Drupal 7 .htaccess file, works like no bodies business. Up-to-date a little to include the https check.