How to all https request to redirect https://.www

Posted by

Check DNS Settings:

  • Ensure that both myhospitalnow.com and www.myhospitalnow.com are pointing to the same server in your DNS settings.
  • Both should have A records or CNAME records pointing to the same IP address or server.

Redirect Configuration:

  • Make sure that your web server (e.g., Apache or Nginx) has the correct redirects set up to handle both www and non-www versions of your domain.
  • If you’re using Apache, you can add a redirect rule to the .htaccess file to handle this.

For Apache (in .htaccess):

vi public/.public and this code


<IfModule mod_rewrite.c>
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

    RewriteCond %{HTTP_HOST} !^www\. [NC]
    RewriteRule (.*) https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x