apache - add www on http and remove www on https -


i trying following:

add www non secure http://domain[.]com http://www.domain[.]com

&

remomve www on secure https://www[.]domain.com https://domain[.]com

i trying doesn't seem work

rewritecond %{https} off rewritecond %{http_host} ^example.org$ rewriterule ^(.*)$ http://www.example.org/$1 [r=301,l]  rewritecond %{https} on rewritecond %{http_host} ^example.org$ rewriterule ^(.*)$ https://example.org/$1 [r=301,l] 

try this:

rewritecond %{https} off rewritecond %{http_host} ^example\.org$ [nc] rewriterule ^(.*)$ http://www.example.org/$1 [r=301,l]  rewritecond %{https} on rewritecond %{http_host} ^www\.example\.org$ [nc] rewriterule ^(.*)$ https://example.org/$1 [r=301,l] 

your second http_host condition still checks www. missing, should other way around.


Comments

Popular posts from this blog

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -