Skip to content

Instantly share code, notes, and snippets.

@miroslav-mrazek
Created January 6, 2018 22:14
Show Gist options
  • Select an option

  • Save miroslav-mrazek/356dd394efc3e52ccba03fd4c654b911 to your computer and use it in GitHub Desktop.

Select an option

Save miroslav-mrazek/356dd394efc3e52ccba03fd4c654b911 to your computer and use it in GitHub Desktop.
Přesměrování na https v Nette 2.4
# root .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^$ www/ [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^www/
RewriteRule ^(.*)$ www/$1
</IfModule>
# www/.htaccess
# disable directory listing
<IfModule mod_autoindex.c>
Options -Indexes
</IfModule>
# enable cool URL
<IfModule mod_rewrite.c>
RewriteEngine On
# RewriteBase /
# prevents files starting with dot to be viewed by browser
RewriteRule /\.|^\. - [F]
# front controller
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule !\.(pdf|js|ico|gif|jpg|png|css|rar|zip|tar\.gz)$ index.php [L]
# use https protocol
RewriteCond %{HTTPS} off
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
# enable gzip compression
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript text/javascript application/javascript application/json
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment