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

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

1 Answers1

0
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L]
</IfModule>
  • It looks like you may have the knowledge to provide good Answers here, but please consider reading [How do I write a good Answer?](http://serverfault.com/help/how-to-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 '18 at 12:41