D
D
Dmitry Vasilyuk2015-09-14 20:45:51
Apache HTTP Server
Dmitry Vasilyuk, 2015-09-14 20:45:51

How to redirect to https from apache subdomain?

My blog is in the domain.ru/blob directory
with htaccess
# BEGIN WordPress
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
# END WordPress
#
#Order Deny,Allow
#Deny from all
#
Tried like this
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)$ https://site.ru/$1 [R=301,L]
but doesn't work on subdomain

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dim Boy, 2015-10-25
@twix007

in apache settings

<VirtualHost *:80>
ServerName site.com
Redirect / https://www.site.com/
ServerAdmin [email protected]
ServerAlias www.site.com
</VirtualHost>


<VirtualHost *:443>
DocumentRoot /home/www/site.com
ServerName site.com
ServerAlias www.site.com
ServerAdmin [email protected]
<Directory "/home/www/site.com">
Options None
AllowOverride All
Require all granted
Options Indexes FollowSymLinks
</Directory>
ErrorLog /home/www/site.com/error.log
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/cert.pem
SSLCertificateKeyFile /etc/apache2/ssl/key.pem
SSLProtocol +TLSv1.2 +TLSv1.1 +TLSv1 -SSLv2 -SSLv3
SSLCACertificateFile /etc/apache2/ssl/site.com.ca-bundle
SSLCACertificateFile /etc/apache2/ssl/ca-certs.pem
SSLUseStapling on
SSLCompression Off
SSLHonorCipherOrder on
SSLCipherSuite "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384 \
ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-RC4-SHA \
ECDHE-RSA-AES256-SHA DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA256 \
DHE-RSA-AES128-GCM-SHA256 DHE-RSA-AES128-SHA256 DHE-RSA-AES256-SHA \
DHE-RSA-AES128-SHA RC4-SHA AES256-GCM-SHA384 AES256-SHA256 \
CAMELLIA256-SHA ECDHE-RSA-AES128-SHA AES128-GCM-SHA256 AES1 \
28-SHA256 AES128-SHA CAMELLIA128-SHA !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS !RC4"
</VirtualHost>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question