CodeIgniter Forums
SSL in .htaccess = ERROR 404 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forum-5.html)
+--- Forum: General Help (https://forum.codeigniter.com/forum-24.html)
+--- Thread: SSL in .htaccess = ERROR 404 (/thread-62640.html)



SSL in .htaccess = ERROR 404 - vertisan - 08-08-2015

I use .htaccess to HTTPS, but i recive error 404. Why?
Here is my code:
Code:
<IfModule mod_rewrite.c>
  RewriteEngine On
  # !IMPORTANT! Set your RewriteBase here and don't forget trailing and leading
  #  slashes.
  # If your page resides at
  #  http://www.example.com/mypage/test1
  # then use
  # RewriteBase /mypage/test1/
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?/$1 [L]

  # ENFORCE SSL
  RewriteCond %{HTTPS} !=on
  RewriteRule ^.*$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>

<IfModule !mod_rewrite.c>

  ErrorDocument 404 /index.php
</IfModule>



RE: SSL in .htaccess = ERROR 404 - CroNiX - 08-09-2015

forcing ssl should occur before the other rewrite rules.


RE: SSL in .htaccess = ERROR 404 - skunkbad - 08-10-2015

I do it like this:


Code:
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://mysite.com/$1 [R,L]