0

I am trying to get URL rewrites as noted in the question title. I created .platform/httpd/conf.d/ssl_rewrite.conf and with the below content, I was able to get http to https rewriting successfully.

RewriteEngine On
<If "-n '%{HTTP:X-Forwarded-Proto}' && %{HTTP:X-Forwarded-Proto} != 'https'">
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
</If>

I am now trying to get the www to route to non-www. I have attempted to add an || clause to that If statement by changing it to <If "(-n '%{HTTP:X-Forwarded-Proto}' && %{HTTP:X-Forwarded-Proto} != 'https') || '%{HTTP_HOST}' !~ /^www\./", but that ended up creating some www.www.example.com routes.

Can someone provide any insight? Is creating multiple statements recommended?

cjanow
  • 47
  • 1
  • 8

0 Answers0