Score:0

Apache http to https rewrite triggering for all requests

vn flag

I have the following in a virtual host:

RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

It works to redirect everything to HTTPS, but the problem is it will still cause a redirect even if the original request is sent via HTTPS. This is causing issues with other integrations because they will receive a 302 Document Has Moved page instead of the actual content.

I have also tried the following condition instead:

RewriteCond %{SERVER_PORT} 80

Any idea how I could prevent a rewrite, or possibly where else to look that might be rewriting for this server?

Thanks!

kz flag
"it will still cause a redirect even if the original request is sent via HTTPS." - Presumably this is causing a redirect-loop? We need to know more information about your server / config and exactly where you are putting this rule in order to answer this. Ordinarily, if you are putting the rule in the vHost then there's never a need to check `HTTPS` anyway (or use mod_rewrite for that matter) since it's in the vHost:80 so cannot possibly be over HTTPS in the first place? How is SSL managed? Do you have a cert installed on this server? Do you have an SSL proxy? Cloudflare? etc.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.