I want assist with url-spinning inshtaccess.

Therefore the problem is all about different methods: https and http. The primary reason for spinning would be to remove "world wide web" from URL, but protocol should stay it had been before.

For instance, after i have URL like http://world wide web.domain.com/request, it ought to be rerouted towards the http://domain.com/request. I resolve it with one of these rules:

RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

But just in case, when URL appears like https://world wide web.domain.com/request it ought to be rerouted to https://domain.com/request.

Regrettably, the above mentioned rule will redirect to http regardless current protocol.

Thanks ahead of time.

This really is fairly like the linked possible duplicate, consider that certain forces www where you need to take it off, it could warrant another answer.

Try something similar to this:

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