title: http to https redirect htaccess
body: <p>I was trying to edit my htaccess file to redirect from http to https.</p>
  
  <p>This one works for all pages except the homepage for every language:</p>
  
  <p><strong><a href="http://cinqueterre.a-turist.com/deu" rel="nofollow">http://cinqueterre.a-turist.com/deu</a>
  redirects to
  <a href="https://cinqueterre.a-turist.com/https://cinqueterre.a-turist.com/deu" rel="nofollow">https://cinqueterre.a-turist.com/https://cinqueterre.a-turist.com/deu</a></strong></p>
  
  <p>It's a little complicated script </p>
  
  <p>Here is it:</p>
  
  <p>Update: I improved a little the script, now it's not such complicated, and doesn't work if I add https redirect</p>
  
  <pre><code>DirectoryIndex 1.php index.html$ index.php
  
  ErrorDocument 404 /404.php
  
  RewriteEngine on
  Options -Multiviews
  
  
  
  RewriteEngine On
  RewriteCond %{HTTPS} !on
  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
  
  
  RewriteCond %{HTTPS_HOST} ^www\.cinqueterre\.a\-turist\.com$ [NC]
  RewriteRule (.*) https://cinqueterre.a-turist.com/$1 [R=301,L]
  
  RewriteCond %{HTTPS_HOST} ^cinqueterre.a-turist\.com$ [OR]
  RewriteCond %{HTTPS_HOST} ^www\.cinqueterre.a-turist\.com$
  RewriteRule ^(rus|ita|fra|deu|ukr|pol|esp)\/index\.php$ https\:\/\/cinqueterre.a-turist\.com\/$1 [R=301,L]
  
  
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME}.php -f
  RewriteRule ^(.+)$ $1.php [L,QSA]
  
  
  #if its not a directory
  RewriteCond %{REQUEST_FILENAME} !-d
  #and it has a trailing slash then redirect to URL without slash
  RewriteRule ^(.+)/$ /$1 [L,R=301]
  
  
  Options All -Indexes
  
  
  ## EXPIRES CACHING ##
  &lt;IfModule mod_expires.c&gt;
  ExpiresActive On
  ExpiresByType image/jpg "access 1 year"
  ExpiresByType image/jpeg "access 1 year"
  ExpiresByType image/gif "access 1 year"
  ExpiresByType image/png "access 1 year"
  ExpiresByType text/css "access 1 month"
  ExpiresByType application/pdf "access 1 month"
  ExpiresByType text/x-javascript "access 1 month"
  ExpiresByType application/x-shockwave-flash "access 1 month"
  ExpiresByType image/x-icon "access 1 year"
  ExpiresDefault "access 2 days"
  &lt;/IfModule&gt;
  ## EXPIRES CACHING ##
  
  
  &lt;ifmodule mod_deflate.c&gt;
  AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
  &lt;/ifmodule&gt;
  </code></pre>