Redirect Through VirtualHost
Hi and thank you in advance
I've recently migrated to EasyApache 4 and I originally had a redirect via VirtualHost that no longer works.
My Rewrite set up is as follows:
And this is inserted into an individual VirtualHost "without SSL" from the official documentation (Link: Modify Apache Virtual Hosts with Include Files - EasyApache 4 - cPanel Documentation) However, if I go to "example.com", it doesn't redirect to "www.example.com". I feel like everything I've done everything correctly but is there an additional change I need to make or am I overlooking something? I just cannot figure out why this no longer works.
RewriteCond %{HTTPS} off
RewriteRule (.*) https://www.example.com%{REQUEST_URI}And this is inserted into an individual VirtualHost "without SSL" from the official documentation (Link: Modify Apache Virtual Hosts with Include Files - EasyApache 4 - cPanel Documentation) However, if I go to "example.com", it doesn't redirect to "www.example.com". I feel like everything I've done everything correctly but is there an additional change I need to make or am I overlooking something? I just cannot figure out why this no longer works.
-
Hello, Do you have any existing rewrite rules in the .htaccess file in the account's public_html directory? Also, could you verify the full steps you took to make the include file? Thank you. 0 -
Thanks! There is not a rewrite rule in the .htaccess file currently. For the steps, using the documentation, I created the includes file. The created path was for individual virtualhost, without ssl. Then I inserted the rewrite rule mentioned above in the .conf file. Rebuilt the httpd.conf file and restarted the Apache. Pretty simple, or so I thought. 0 -
Hello, You can try using one of the examples on the following post to see if it helps: HTTP to HTTPS redirects for Drupal Multisite Setup Additionally, run this command after making the change: /usr/local/cpanel/scripts/ensure_vhost_includes --all-users
Thank you.0 -
Michael, Thank you so much for your help! I think the script was the missing piece I needed and everything is working accordingly. Have a great week and take care! 0
Please sign in to leave a comment.
Comments
4 comments