D
D
Dim Boy2016-01-14 23:25:14
Apache HTTP Server
Dim Boy, 2016-01-14 23:25:14

How to solve the problem with .htaccess redirects?

Please help with redirect issues.
Need:
https://www.site.com > https://site.com
www.site.com > https://site.com
site.com > https://site.com
What's wrong, please tkinte! ?
My Apache2 .conf:

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

<IfModule mod_ssl.c>
SSLStaplingCache shmcb:/tmp/stapling_cache(128000)
  <VirtualHost *:443>
  Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains"
  ServerName site.today
  ServerAdmin [email protected]
    RewriteEngine On
    RewriteOptions inherit
    # Redirect
    RewriteCond %{HTTP_HOST} !^site\.today$ [NC]
    RewriteRule ^ https://site.today%{REQUEST_URI} [L,R=301]

    # Indexes + Directory Root.
    DocumentRoot /home/www/site.today/
    AddDefaultCharset utf-8
  <Directory "/home/www/site.today">
    Options None
    AllowOverride All
    Require all granted
    Options Indexes FollowSymLinks
  </Directory>
    ErrorLog /home/www/site.today/error.log
    # SSL
    SSLEngine on
    SSLCertificateKeyFile /etc/apache2/ssl/site/www.site.today.key
    SSLCertificateFile /etc/apache2/ssl/site/2_www.site.today.crt
    SSLCACertificateFile /etc/apache2/ssl/site/1_root_bundle.crt
  SSLUseStapling on
     </VirtualHost>
</IfModule>

My htacess:
AddDefaultCharset UTF-8
Options +FollowSymlinks -MultiViews
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)([^/])$ http://%{HTTP_HOST}/$1$2/ [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.php\ HTTP/
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTP_HOST} !^localhost
RewriteRule .* http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

Yes, and when creating a subdomain with https:// or without "sub.site.com":
NET::ERR_CERT_COMMON_NAME_INVALID

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question