0

I want to redirect non-www to www, and http to https. I am using this:

RewriteEngine On

RewriteCond %{HTTP_HOST} ^botway.com
RewriteRule ^ https://www.botway.com%{REQUEST_URI} [R=301,L]

RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

http://www.botway.com is redirecting correctly to https

https://botway.com is redirecting correctly to www.

BUT, when I type http://botway.com (so no https and no www, triggering both conditions) it redirects me to https://www.botway.com/https://botway.com/ (404 error)

You can test it live on the domain mentioned above. Any ideas on how to solve the conflict between the two Rewrite conditions?

I already looked for similar questions on SO (like this one and this one) but the solutions provided there are like the code I am using, and they have the same problem.

Community
  • 1
  • 1
Daniel Scocco
  • 7,036
  • 13
  • 51
  • 78

0 Answers0