subdomain redirect question

Discussion in 'Linux VPS/Dedicated - General' started by AlexH, May 10, 2014.

  1. AlexH

    AlexH Member


    I have a subdomain (, which has a SSL certificate installed. Because of the way subdomains are set up, I can still access the content at

    I would like to redirect all of the traffic to to ensure they are using the store with SSL.

    I thought I would just redirect traffic using a redirect, but it warned me that it would cause a loop.

    What's the best way to handle this?
  2. esoft

    esoft New Member


    You may use mod_rewrite.
    i.e. add the following lines to your .htaccess (in subdomain root)

    RewriteEngine On
    RewriteCond %{HTTPS} !=on
    RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
    ensure to change the SERVER_NAME with your subdomain.

    or you may use <VirtualHost>directives also.
  3. AlexH

    AlexH Member

    Perfect, thanks!

Share This Page