title: How can I redirect domain name in http without www to https?
body: <p>I want to redirect <code>http://example.com</code> to <code>https://example.com</code> and <code>http://www.example.com</code> to <code>https://www.example.com</code>. My application is developed in Laravel framework version 4.2</p>
  
  <p>By following instructions given in following link I have editted my .htaccess file by following given link. But it is not working
  <a href="https://stackoverflow.com/questions/17453412/redirect-to-http-non-www-to-https-www-htaccess">link of suggestion</a></p>
  
  <p>Complete code in .htaccess file is given below</p>
  
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
      &lt;IfModule mod_negotiation.c&gt;
          Options -MultiViews
      &lt;/IfModule&gt;
  
      RewriteEngine On
  
  
  
  # Redirect Trailing Slashes...
      RewriteRule ^(.*)/$ /$1 [L,R=301]
  
      # Handle Front Controller...
      RewriteCond 
  
  %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteRule ^ index.php [L]
  &lt;/IfModule&gt;
  
  RewriteEngine On
  
  RewriteCond %{HTTP_HOST} !^www\. [NC]
  RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
  
  RewriteCond %{HTTPS} off
  RewriteRule ^(.*)$ https://www.example.com/$1 [L,R=301] 
  
  # compress text, html, javascript, css, xml:
  AddOutputFilterByType DEFLATE text/plain
  AddOutputFilterByType DEFLATE text/html
  AddOutputFilterByType DEFLATE text/xml
  AddOutputFilterByType DEFLATE text/css
  AddOutputFilterByType DEFLATE application/xml
  AddOutputFilterByType DEFLATE application/xhtml+xml
  AddOutputFilterByType DEFLATE application/rss+xml
  AddOutputFilterByType DEFLATE application/javascript
  AddOutputFilterByType DEFLATE application/x-javascript
  </code></pre>
  
  <p>My http-vhost file also given below</p>
  
  <pre><code>&lt;VirtualHost *:443&gt;
      DocumentRoot "C:\xampp\htdocs\mysite\example"
      ServerName example.com
      ServerAlias www.example.com
      SSLEngine on
      SSLCertificateFile "conf/ssl/example.crt"
      SSLCertificateKeyFile "conf/ssl/example.key"
      ErrorDocument 404 "ERROR 404 : PAGE NOT FOUND"  
      ##ErrorLog "logs/dummy-host2.example.com-error.log"
      ##CustomLog "logs/dummy-host2.example.com-access.log" common  
    &lt;Directory "C:\xampp\htdocs\mysite\example"&gt;
      Order allow,deny
      Allow from all
    &lt;/Directory&gt;
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>Can anyone help me to solve this issue?</p>