can a .htaccess redirect be conditional?

Discussion in 'Apache' started by yulsa, Oct 8, 2010.

  1. #1
    Hello,

    Wondering if anyone can suggest something...

    Is it possible to put a condition in .htaccess that will only run a certain redirect/code if a specific file is called?

    Basically, right now I have a rule that calls a code if something/someone is trying to access a specific folder ('hr') The rule in .htaccess looks like this:

    RewriteRule ^hr/(.*)$ /en?t=/CustomCode/redirect/hr&cond=$1

    But I want to add a condition that if the file in question is of the format /index_xx_eng.html (where xx is a number), do not run the code (I don't want it redirecting). So far I figured that regular expression for this file name would be index_..*_eng\.html

    What do I need to write in .htaccess to stop redirecting if a file in folder 'hr' (or any of its subfolders) is one of those index_xx_eng.html files?

    Thank you in advance.
     
    yulsa, Oct 8, 2010 IP