Redirect http to https (cookies clear) at sub secondary website create

Hi support team...
i have a redirect ssl http to https is working at main site and admin network, at the sub secondary site not redirect ssl.
1. i try fix delete a redirect coding at htacces (is perfect working but not redirect to https)
2. i try paste a code in htacces (subsite is working, but clear your cookies)

Redirect SSL code:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

htacces with redirect ssl code:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]

# Yoast SEO - XML Sitemap Rewrite Fix
RewriteEngine On
RewriteBase /
RewriteRule ^sitemap_index.xml$ /index.php?sitemap=1 [L]
RewriteRule ^locations.kml$ /index.php?sitemap=wpseo_local_kml [L]
RewriteRule ^geo_sitemap.xml$ /index.php?sitemap=geo [L]
RewriteRule ^([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?sitemap=$1&sitemap_n=$2 [L]
RewriteRule ^([a-z]+)?-?sitemap.xsl$ /index.php?xsl=$1 [L]
# END Yoast SEO - XML Sitemap Rewrite Fix

# BEGIN WP-HUMMINGBIRD-GZIP

# END WP-HUMMINGBIRD-GZIP
# BEGIN WP-HUMMINGBIRD-CACHING

<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault A0

<FilesMatch "\.(txt|xml|js)$">
ExpiresDefault A86400
</FilesMatch>

<FilesMatch "\.(css)$">
ExpiresDefault A86400
</FilesMatch>

<FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav|mp4|m4v|ogg|webm|aac)$">
ExpiresDefault A86400
</FilesMatch>

<FilesMatch "\.(jpg|jpeg|png|gif|swf|webp)$">
ExpiresDefault A86400
</FilesMatch>
</IfModule>

<IfModule mod_headers.c>
<FilesMatch "\.(txt|xml|js)$">
Header set Cache-Control "max-age=86400"
</FilesMatch>

<FilesMatch "\.(css)$">
Header set Cache-Control "max-age=86400"
</FilesMatch>

<FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav|mp4|m4v|ogg|webm|aac)$">
Header set Cache-Control "max-age=86400"
</FilesMatch>

<FilesMatch "\.(jpg|jpeg|png|gif|swf|webp)$">
Header set Cache-Control "max-age=86400"
</FilesMatch>
</IfModule>
# END WP-HUMMINGBIRD-CACHING

  • Predrag Dubajic

    Hey kamarulpro,

    Hope you're doing well today

    Can you try replacing this line in your .htaccess:
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    With this one:
    RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]

    If that doesn't work you may want to give it a try with plugins like these:
    https://wordpress.org/plugins/really-simple-ssl/
    https://wordpress.org/plugins/https-redirection/

    Let us know how it goes.

    Best regards,
    Predrag

  • Adam Czajczyk

    Hello kamarulpro!

    It seems like your .htaccess file is a bit "combined". I mean, it includes some duplicated directives and also rules that should be used for a single site install. I tried to clear it up (assuming it's a sub-domain based multisite). Could you please this one instead of your current one?

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    
    RewriteCond %{HTTPS} !=on
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    
    RewriteRule ^index\.php$ - [L]
    
    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]
    
    # Yoast SEO - XML Sitemap Rewrite Fix
    RewriteRule ^sitemap_index.xml$ /index.php?sitemap=1 [L]
    RewriteRule ^locations.kml$ /index.php?sitemap=wpseo_local_kml [L]
    RewriteRule ^geo_sitemap.xml$ /index.php?sitemap=geo [L]
    RewriteRule ^([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?sitemap=$1&sitemap_n=$2 [L]
    RewriteRule ^([a-z]+)?-?sitemap.xsl$ /index.php?xsl=$1 [L]
    # END Yoast SEO - XML Sitemap Rewrite Fix
    
    </IfModule>
    
    # BEGIN WP-HUMMINGBIRD-CACHING
    
    <IfModule mod_expires.c>
    ExpiresActive On
    ExpiresDefault A0
    
    <FilesMatch "\.(txt|xml|js)$">
    ExpiresDefault A86400
    </FilesMatch>
    
    <FilesMatch "\.(css)$">
    ExpiresDefault A86400
    </FilesMatch>
    
    <FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav|mp4|m4v|ogg|webm|aac)$">
    ExpiresDefault A86400
    </FilesMatch>
    
    <FilesMatch "\.(jpg|jpeg|png|gif|swf|webp)$">
    ExpiresDefault A86400
    </FilesMatch>
    </IfModule>
    
    <IfModule mod_headers.c>
    <FilesMatch "\.(txt|xml|js)$">
    Header set Cache-Control "max-age=86400"
    </FilesMatch>
    
    <FilesMatch "\.(css)$">
    Header set Cache-Control "max-age=86400"
    </FilesMatch>
    
    <FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav|mp4|m4v|ogg|webm|aac)$">
    Header set Cache-Control "max-age=86400"
    </FilesMatch>
    
    <FilesMatch "\.(jpg|jpeg|png|gif|swf|webp)$">
    Header set Cache-Control "max-age=86400"
    </FilesMatch>
    </IfModule>
    # END WP-HUMMINGBIRD-CACHING

    Please make a copy of your current .htaccess just you needed to restore it. Also, this version doesn't include change suggested by Predrag so if it doesn't work as you need it to but doesn't break your site, implement Predrag's change on this code please and give it another try.

    Let me know if that works

    Best regards,
    Adam