Answers.Body: <p>For better practice, you should never use ".htaccess" file. Especially your problem can be easily solved by modify Apache configure file.</p>
  
  <p>You should be able to find an Apache configure file somewhere in your /etc folder. 
  On my server its /etc/httpd/conf/httpd.conf.</p>
  
  <p>Then just find the code </p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
     ... your server setting
     ServerName your-server-address.com
     # add the following line
     Redirect permanent / https://your-server-address.com/
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>Don't forget to restart your server after you done the change.
  This will redirect any traffic trying to visit your site with none ssl to ssl, regardless your folder structure.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-08-15T00:55:44.203Z
Answers.LastActivityDate: 2019-08-16T01:22:59.320Z
Answers.LastEditDate: 2019-08-16T01:22:59.320Z
Answers.UserDisplayName: Parry Huang
Body: <p>I'm having issues forcing an SSL on my website. I think the issue may be that my root folder is my 'web' folder.</p>
  
  <p>I've searched online and tried a few variations of htaccess but none of them seem to work.</p>
  
  <p>Here is the latest I've tried:</p>
  
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
      RewriteEngine On
      RewriteCond %{HTTPS} off
      RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  
      # Send would-be 404 requests to Craft
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]
      RewriteRule (.+) index.php?p=$1 [QSA,L]
  &lt;/IfModule&gt;
  </code></pre>
  
  <p>My domain points to my web folder and my htaccess belongs in the web folder.</p>
  
  <p>Thanks,</p>
  
  <p>Joe</p>
  
Tags: <craft3><ssl>
Title: Force SSL on sub folder
ThreadText: # Force SSL on sub folder
  
  (Asked by: username_0 on 2019-08-14)
  
  I'm having issues forcing an SSL on my website. I think the issue may be that my root folder is my 'web' folder.
  
  I've searched online and tried a few variations of htaccess but none of them seem to work.
  
  Here is the latest I've tried:
  
  ```
  <IfModule mod_rewrite.c>
      RewriteEngine On
      RewriteCond %{HTTPS} off
      RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  
      # Send would-be 404 requests to Craft
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]
      RewriteRule (.+) index.php?p=$1 [QSA,L]
  </IfModule>
  
  ```
  
  My domain points to my web folder and my htaccess belongs in the web folder.
  
  Thanks,
  
  Joe
  
  **Tags:** craft3, ssl
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-08-15. Score: 1
  
  For better practice, you should never use ".htaccess" file. Especially your problem can be easily solved by modify Apache configure file.
  
  You should be able to find an Apache configure file somewhere in your /etc folder.
  On my server its /etc/httpd/conf/httpd.conf.
  
  Then just find the code
  
  ```
  <VirtualHost *:80>
     ... your server setting
     ServerName your-server-address.com
     # add the following line
     Redirect permanent / https://your-server-address.com/
  </VirtualHost>
  
  ```
  
  Don't forget to restart your server after you done the change.
  This will redirect any traffic trying to visit your site with none ssl to ssl, regardless your folder structure.
  
  
  ---
  
  