Force HTTPS rewrite on site except one directory

Discussion in 'Installation/Configuration' started by DexDeadly, Apr 5, 2017.

  1. DexDeadly

    DexDeadly New Member

    Is it possible to have 1 directory on my site not force https? I need the directory to allow just http access to it and not https to use elsewhere. Please let me know if this is possible.
     
  2. linus

    linus Member

    You should be able to do it with an apache directive (web domain - options - apache directive)
    This worked for me where test is the name of your folder also allowing http:

    Code:
    RewriteEngine on
    
    RewriteCond %{REQUEST_URI} !^/test/.*$ 
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
    
     
  3. DexDeadly

    DexDeadly New Member

    Hello Linus, thanks for that. I just gave it a try and it still seems when I go to the folder it redirects to https still. I even tried to ensure that I have the Redirect checkbox unchecked.
     
  4. linus

    linus Member

    Do you have anything else that redirects? If you remove that directive completely, does it still redirect? Did you use the trailing slash too test/ ?
     
  5. DexDeadly

    DexDeadly New Member

    So I took it out, saved it and then placed it back in. I removed the / at the end of the line and resaved it and now it seems good. Thank you very much, now to wait 4 hours until I can go home and actually see if doing this fixes what I needed it to.
     

Share This Page