Note that there are some explanatory texts on larger screens.

plurals
  1. POMod_rewrite: Force SSL on specific pages. Add www on none-secure pages
    primarykey
    data
    text
    <p>I know this is a common topic, but I've done my utmost to resolve it with the help of the solutions I've found searching the web.</p> <p>We have a certificate linked to the subdomain secure.mysite.com, and we want to achieve the following:</p> <ol> <li><p>We need to force SSL on the following paths and their subpages:<br> http://mysite.com/services[/.../...] => https://secure.mysite.com/services[/.../...]<br> http://mysite.com/login[/.../...] => https://secure.mysite.com/login[/.../...]<br> http://mysite.com/member[/.../...] => https://secure.mysite.com/member[/.../...]<br> http://mysite.com/admin[/.../...] => <a href="https://secure.mysite.com/admin" rel="nofollow">https://secure.mysite.com/admin</a></p></li> <li><p>We want to add www on all none-secure paths (all paths except the ones mentioned above)</p></li> <li><p>We want to remove www on all secure paths (all the ones mentioned above)</p></li> </ol> <p>The following is what I have put in my .htaccess-file, without success:</p> <pre><code># force HTTPS RewriteCond %{HTTPS} =off RewriteRule ^(services|login|member|admin)$ https://secure.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] # force HTTP RewriteCond %{HTTPS} =on RewriteRule !^(services|login|member|admin)$ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] # remove www from host when HTTPS RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] RewriteCond %{HTTPS} =on RewriteRule ^ http%2://%1%{REQUEST_URI} [L,R=301] # add www from host when HTTP RewriteCond %{HTTP_HOST} !^www\. RewriteCond %{HTTPS} =off RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] # Zend redirect logic RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [NC,L] RewriteRule ^.*$ index.php [NC,L] </code></pre>
    singulars
    1. This table or related slice is empty.
    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. This table or related slice is empty.
    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