Help with htaccess

Discussion in 'Joomla' started by carlosvilla, Dec 3, 2014.

  1. #1
    Hi everybody. I'm new here and I need your help.

    I have 4 Joomla websites, 1 on my main domain and 3 on subdomains. I need to redirect all requests to https except the requests to the subdomains.

    For example:
    domain.com should be redirected to HTTPS
    blog.domain.com should not be redirected to HTTPS

    Thank you!
     
    carlosvilla, Dec 3, 2014 IP
  2. AMJAlienServers

    AMJAlienServers Peon

    Messages:
    28
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    3
    #2
    This code will redirect the website to HTTPS using .htaccess:

    RewriteEngineOn
    RewriteCond%{SERVER_PORT}80
    RewriteRule^(.*)$ https://www.example.com/$1 [R,L]
    Please, note that the .htaccess should be located in the web site main folder.

    In case you wish to force HTTPS for a particular folder you can use:

    RewriteEngineOn
    RewriteCond%{SERVER_PORT}80
    RewriteCond%{REQUEST_URI} foldername
    RewriteRule^(.*)$ https://www.domain.com/foldername/$1 [R,L]
    The.htaccess file should be placed in the folder where you need to force HTTPS.
     
    AMJAlienServers, Dec 3, 2014 IP
  3. koolzen

    koolzen Active Member

    Messages:
    27
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    58
    #3
    Hi,
    Modify your .htaccess file
    You have to add a condition before the RewriteRule. The syntax is "RewriteCond %{HTTP_HOST} !=m.example.com"

    For more detail check this out http://stackoverflow.com/questions/10789598/htaccess-redirect-to-https-except-subdomain
     
    koolzen, Dec 3, 2014 IP
    Nigel Lew likes this.
  4. antonione77

    antonione77 Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #4
    Yeah, you have to add a condition before the RewriteRule "RewriteCond %{HTTP_HOST} !=m.example.com"
     
    antonione77, Oct 5, 2016 IP