.htaccess如何在不同的操作系统下使用不同的指令

时间:2012-09-18 17:20:18

标签: php apache svn .htaccess lamp

我开发了机器,这是Windows,我将我的网站部署到ubuntu服务器。那么,一个.htaccess文件如何在不同的环境下使用不同的指令。

例如:

php_value auto_prepend_file D:\ 123 \ bigsite \ include \ global.php

在ubuntu中,我应该用另一个位置替换该值。

我使用svn和post hook自动检出文件到ubuntu服务器,所以当我签​​入svn时,.htaccess内容在windows中是相同的

1 个答案:

答案 0 :(得分:1)

只要您将Apache设置为相同,您的.htaccess文件在Windows或Linux上的工作方式相同。

您当然可以在您的开发计算机上安装一个.htaccess文件,在生产服务器上安装另一个文件,但请记住不要错误地覆盖它们。如果您使用的是svn,则应将.htaccess添加到ignore list

例如,如果Windows计算机上的.htaccess文件包含以下行: -

  

php_value auto_prepend_file D:\ 123 \ bigsite \ include \ global.php

然后你的ubuntu机器上的.htaccess文件可能是: -

  

php_value auto_prepend_file /srv/123/bigsite/include/global.php

http://httpd.apache.org/docs/current/howto/htaccess.html