Apache přesměrování na HTTPS

MoneyManager

Apache přesměrování na HTTPS
« kdy: 09. 02. 2016, 11:02:24 »
Zdravim vo spolok.

Moj hosting zacal podporovat Let's Encrypt. Vygeneroval som certifikat a funguje to skvele. Problem je ze netusim ako zmenit v .htaccess zmenit nastavenie tak aby vsetko smerovalo na https namiesto http.

Kód: [Vybrat]
AddType video/mp4 .mp4
#Options -MultiViews
#Options -Indexes

<IfModule mod_rewrite.c>
## Uncomment (remove # ONLY NOT ##) line below if installed in folder and add folder name after /
## Example: Script is installed in /public_html/folder/ then it should be: Rewritebase /folder/
## Then the files below should be (add slash to all): /index.php?action=$1
## Uncomment the code below to Use PHP 5.4
# AddHandler application/x-httpd-php54 .php

RewriteEngine On

## Uncomment the following line to use the multi-domain feature
# RewriteCond %{HTTP_HOST} ^yourseconddomain\.com$ [NC]
# RewriteRule ^(.*)$ http://yourfirstdomain.com/$1 [R=301,L]

#Rewritebase /
## Admin Panel
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^admin/(.*)?$ admin/index.php?a=$1 [QSA,NC,L]

## Application Handler
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)?$ index.php?a=$1 [QSA,NC,L]
</IfModule>

## Error 404 ##
ErrorDocument 404 /index.php?a=404

Toto  je moj .htaccess. Dakujem za rady
« Poslední změna: 09. 02. 2016, 11:12:11 od Petr Krčmář »


source

Re:Apache přesměrování na HTTPS
« Odpověď #1 kdy: 09. 02. 2016, 11:52:59 »

Re:Apache přesměrování na HTTPS
« Odpověď #2 kdy: 09. 02. 2016, 12:12:26 »
Kód: [Vybrat]
RewriteCond %{HTTPS} off
# First rewrite to HTTPS:
# Don't put www. here. If it is already there it will be included, if not
# the subsequent rule will catch it.
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Now, rewrite any request to the wrong domain to use www.
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Když chceš, dokážeš vše!

Re:Apache přesměrování na HTTPS
« Odpověď #3 kdy: 09. 02. 2016, 12:41:37 »
Kód: [Vybrat]
RewriteCond %{HTTPS} off
# First rewrite to HTTPS:
# Don't put www. here. If it is already there it will be included, if not
# the subsequent rule will catch it.
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Now, rewrite any request to the wrong domain to use www.
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

doporučuji to samé