FireFoxII
FireFoxII

Reputation: 828

htaccess simulate rewritecond IF..ELSE against ip address

I have a php_value auto_prepend_file in my htaccess that I use with absolute path... This on my localhost, but when I upload on web server I need different absolute path...

#php_value auto_prepend_file "/path/to/web/server/auto_prepend.php"
php_value auto_prepend_file "/path/to/local/server/auto_prepend.php"

Then I need something like

if ( ipaddress == serverip )
   php_value auto_prepend_file "/path/to/web/server/auto_prepend.php"
else
   php_value auto_prepend_file "/path/to/local/server/auto_prepend.php"

Upvotes: 1

Views: 659

Answers (1)

Amit Verma
Amit Verma

Reputation: 41219

On apache 2.4 you can do something like the following :

<if "%{REMOTE_ADDR} ='yourip'">
php_value auto_prepend_file "/path/to/file/"
</if>
<else "%{REMOTE_ADDR} !='yourip'">
#Your php_value directive
</else>

I have not tested this.

Upvotes: 1

Related Questions