Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It results in a redirect loop because your <code>RewriteCond</code> pair will always evaluate to <code>true</code>. You first want to check that you're actually on the SSL port, then you want to make sure that the request doesn't match your secure paths.</p> <p>Your three commented-out lines should therefore be changed to this:</p> <pre><code>RewriteCond %{SERVER_PORT} =443 RewriteCond %{REQUEST_URI} !^/account(.*)$ RewriteCond %{REQUEST_URI} !^/shop/checkout(.*)$ RewriteRule ^(.*)$ http://www.domain.com/$1 </code></pre> <p><strong>Edit:</strong> Apparently you do actually need the explicit <code>[R,L]</code> on that redirect. Additionally, <code>mod_rewrite</code> performs an internal redirection of the URL <code>/index.php</code>, which doesn't match the secure paths checked for by the <code>RewriteCond</code>s, so the rewritten rule gets re-rewritten back to the http domain. The following should resolve both of these issues, albeit in a somewhat non-foolproof way:</p> <pre><code>RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{SERVER_PORT} =443 RewriteCond %{REQUEST_URI} !^/account(.*)$ RewriteCond %{REQUEST_URI} !^/shop/checkout(.*)$ RewriteRule ^(.*)$ http://www.domain.com/$1 [R,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{SERVER_PORT} !^443$ RewriteRule ^(shop/checkout|account)(.*)$ https://www.domain.com/$1$2 [R,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)?$ index.php?_args=$1 [QSA] </code></pre> <p>People could still theoretically come in unsecured via <code>http://www.domain.com/index.php?_args=account</code> this way, so if that bothers you it's possible to write some more complex <code>RewriteCond</code> directives to handle that situation. It's a bit overkill though if you aren't worried about that. Unfortunately there's no good way that I'm aware of to know that an internal rewrite was performed, otherwise this would be much easier to account for.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload