Posted By

acosonic on 11/23/17


Tagged

cakephp modrewrite htaccess letsencrypt


Versions (?)

Htaccess rewrite file for Letsencrypt and CakePHP app


 / Published in: Apache
 

URL: https://stackoverflow.com/questions/38790421/letsencrypt-with-htaccess/41391957#41391957

This .htaccess actually forces all traffic to https, and allows cakephp app to work properly, as well as letsencrypt to go thru

  1. <IfModule mod_rewrite.c>
  2. RewriteEngine on
  3.  
  4. RewriteRule ^.well-known/ - [L,NC]
  5.  
  6. RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
  7. RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
  8.  
  9. RewriteCond %{HTTPS} !=on
  10. RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
  11.  
  12. RewriteRule ^$ app/webroot/ [L]
  13. RewriteRule (.*) app/webroot/$1 [L]
  14. </IfModule>

Report this snippet  

You need to login to post a comment.