0

I recently shifted to https:// with SSL for Multi Domain

I have a domain in subfolder say domain.com

when I try to access example.com it goes fine to https://www.example.com

However If I type example.com/blog it goes to https://www.example.com/subfolder/blog

I am using following .htacesss to redirect http to https in both primary and subfolder domains

# HTTPS Rewrite
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

I think editing this somehow should fix this problem, please help

2
  • 2
    Do you have another .htaccess in the blog directory? What is in your Apache configuration? Dec 12, 2018 at 3:05
  • In general redirecting simple sites to https is better done with a Redirect directive on the plain http VirtualHost entry as per httpd.apache.org/docs/2.4/rewrite/avoid.html#redirect (if you have access to the server configuration that is)
    – HBruijn
    Dec 12, 2018 at 8:18

1 Answer 1

0
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L]
</IfModule>
1
  • It looks like you may have the knowledge to provide good Answers here, but please consider reading How do I write a good Answer? in our help center and then revise the Answer. Your Commands/Code/Settings may technically be the solution but some explanation is welcome. Thanks in advance.
    – HBruijn
    Dec 12, 2018 at 12:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .