views:

36

answers:

1

I've recently had to put some code into a different server and my .htaccess file fails miserably. I can stripe out all the parts I don't need but the thing is I'd like to have it on source-control (one file serves many scenarios).

Can we have fail-safe rules? I think I'm looking for an if else clause here.

# IF THIS IS ALLOWED DO IT #
AuthType none 
Satisfy any 

# IF THIS IS ALLOWED DO IT #
DirectoryIndex index.htm index.php
AddHandler php5-script .php

Thank you.

+1  A: 

I think there is an <IfModule> thing in htaccess:

<IfModule mod_auth_basic.c>
  AuthType basic
  Satisty any
</IfModule>

<IfModule mod_php.c>
   DirectoryIndex index.htm index.php
   AddHandler php5-script .php
</IfModule>

but I don't think there is an module for AuthType... The IfModule !mod_a.c checks if mod_a.c NOT exists. However, I don't know if there are version checks and try-catches.

SHiNKiROU