htaccess if statement

前端 未结 2 378
暗喜
暗喜 2021-02-04 08:02

I have the following line in my .htaccess file to select which version of PHP to use:

AddType x-httpd-php53 .php

This works great

2条回答
  •  广开言路
    2021-02-04 08:53

    Another alternative you can do is to change httpd.conf in the test environment to use ".htaccess-test" instead of ".htaccess".

    This is simply done by modifying httpd.conf and adding the following line outside of any block:

    AccessFileName .htaccess-test
    

    NOTE: You can add AccessFileName inside a block if you want to apply it to a specific VirtualHost.

    What this means is that the test environment will use .htaccess-test while the production environment will use .htaccess. Hence, you get the freedom of configuring each environment separately.

    Then create a file named .htaccess-test adjacent to .htaccess. Modify .htaccess-test with your test configuration, then finally restart Apache Web server in the test environment server.

提交回复
热议问题