Etiket arşivi: redirect subdomain http to https

Belirli bir site hariç tüm istekleri 443’e yönlendirme

 ServerName blabla.com
 ServerAlias www.blabla.com
 RewriteEngine on

 RewriteCond %{HTTP_HOST} ^(www\.)?buharic.com [NC]
 RewriteRule ^ - [L]
 RewriteRule ^/?(.*) https://%{HTTP_HOST}/$1

Yukarıdaki kural ile apache web sunucusuna gelen buharic.com haricinde gelen tüm istekler 443 portuna (https) yönlendirelecektir. Bu kural ile buharic.com isteği gelirse alttaki kurallar çalıştırılmayacak bu sayede yönlendirme yapılmayacaktır.

Ayrıca http://htaccess.madewithlove.be htaccess tester web sitesinden kurallarınızı test edebilirsiniz.

Apache2 redirect subdomains http to https

Edit /etc/apache2/sites-available/000-default as;

ServerAdmin admin@domain.com
ServerName domain.com
ServerAlias www.domain.com
RewriteEngine on
ReWriteCond %{SERVER_PORT} !^443$
RewriteRule ^/?(.*) https://%{HTTP_HOST}/$1 [NC,R,L]

Source: https://www.digitalocean.com/community/questions/ubuntu-14-04-apache2-how-to-confi-https-and-subdomain