Questions tagged [ifdefine]

Use this tag for questions about the configuration parameter for Apache (and include the Apache tag). Do not use this for questions about the C preprocessor or GNU Make.

7 questions
15
votes
6 answers

Apache .htaccess - applying basic authentication conditionally based on environment or hostname

My dev setup: Mac OSX 10.7.4 / Apache 2.2.21 / PHP 5.3.10 I wish to add conditional logic to my .htaccess files depending on dev vs live environment. for example i want to have authentication on the live server but not on the dev server. i have in…
Devin Emke
  • 181
  • 1
  • 1
  • 7
5
votes
3 answers

How to do conditional .htaccess password protect

I'm trying to password protect a specific url using a .htaccess. Different urls point to the same files but have different workings. I now need to password protect only one url. I'm trying to do this using setenvif but it doesn't seem to work. I…
Clooner
  • 139
  • 3
  • 10
4
votes
4 answers

SetEnvIf HTTP_HOST not working

I can't get it work this part of .htaccess, the IfDefine never runs. What am I doing wrong, setenvif mod is enabled. RewriteBase / SetEnvIf HTTP_HOST ^localhost$ local RewriteBase /codeigniter-app/ SetEnvIf HTTP_HOST…
Alex
  • 7,538
  • 23
  • 84
  • 152
3
votes
2 answers

Conditional Directory Index In Htaccess

This relates to the question in: conditional DirectoryIndex in .htaccess The answer states that the following should work: SetEnvIf Remote_Addr ^127\.0\.0\.0$ owner DirectoryIndex index.html
Lizard
  • 43,732
  • 39
  • 106
  • 167
1
vote
2 answers

Why directive not working (Apache 2.4)?

I'm trying to block a IP list generated by CustomLog using IfDefine to avoid log ip again, but it's not working. I changed CustomLog conditional and something bizarre behavior can be observed: RewriteMap blacklist…
Arthur Ronconi
  • 2,290
  • 25
  • 25
0
votes
1 answer

IfDefine and RewriteBase doesn't work well together

When I use this code, it works just okay: RewriteBase ${ServerBase} But when I add this, it always uses RewriteBase \ which was not what I want. RewriteBase / The…
Aminah Nuraini
  • 18,120
  • 8
  • 90
  • 108
0
votes
0 answers

ifDefine varOne | varTwo

Is something to the effect of this possible without nesting in a htaccess file? .... Ideally I would use an environment variable but this is not possible in this case.
matthewjewell
  • 140
  • 1
  • 9