Issue
I'm trying to redirect URL responses from https://domain.com to https://www.domain.com in the apache24 configuration, I'm using Redhat Server.
I have tried to create this Rewrite Condition but its not working
RewriteCond %{HTTP_HOST} ^(domain\.com)?$
RewriteRule (.*) https://www.domain.com/$1 [R=301,L]
Solution
I have fixed the Issue by using Directive IF Condition powered by Apache2.4
I have added this code to my ssl.conf file where it redirected all requests sent to https:// domain .com to https:// www .domain .com . Add this code before the Tag :
<If "%{HTTP_HOST} != 'www.domain.com'">
Redirect "/" "https://www.domain.com/"
</If>
Thank you all for your comments and trying to fix my issue, really its something I appreciate it. Please take a look @ for more information about httpd24 directives https://httpd.apache.org/docs/2.4/mod/directives.html
Answered By - Mohamed Moheb