You know how to set a htaccess redirect except for one directory?

Discussion in 'Apache' started by EApubs, May 2, 2011.

  1. #1
    Hi,

    I just want to add a htaccess redirect to my site to redirect all the https urls to http urls except for one folder.. That folder should use https... Know how to do this?
     
    EApubs, May 2, 2011 IP
  2. joebert

    joebert Well-Known Member

    Messages:
    2,150
    Likes Received:
    88
    Best Answers:
    0
    Trophy Points:
    145
    #2
    If you don't have any other mod_rewrite directives that need to apply in that directory, you can just turn mod_rewrite off in that directories htaccess.

    RewriteEngine off
    Code (markup):
     
    joebert, May 5, 2011 IP
  3. ntomsheck

    ntomsheck Peon

    Messages:
    87
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Put the folder you do not want to redirect first in the .htaccess (before the https redirect). Mod_rewrite is linear, and will stop after the first match (as long as you use an [L] flag).
     
    ntomsheck, May 9, 2011 IP