1

I am currently developing a PHP application using JetBrains PhpStorm. This applications contains several .htaccess files.

As there is right now no automated deployment process for this application I am using the "Upload to..." feature in PhpStorm. Using this feature the application is deployed to several servers.

The .htaccess files in my application need to have different content on different servers (staging systems vs production etc.). Unfortunately, so far I have not found a way to manage this reliably and have repeatedly overwritten .htaccess files with versions which are not suitable for the server I am deploying to.

Is there a way to make PhpStorm transform my .htaccess file before it is deployed? Or could I maybe define different versions of the same file for different servers?

Chris
  • 6,914
  • 5
  • 54
  • 80
  • Nope -- at least using Deployment facility -- it just transfers files without making any modifications to them. Possibly you need to have some sort of build tool (e.g. Phing task) that you can **manually** launch before deployment -- such task could do such modifications. – LazyOne Jan 14 '15 at 17:08
  • 1
    What's about to skip the upload of the .htaccess files? You find the skip option in the deployment settings. – Joerg Jan 15 '15 at 21:31
  • 1
    @Joerg Thanks, this might be at least a temporary workaround. The problem is that I sometimes make changes in the .htaccess file which should be merged to all servers which is why I would prefer a transformation. – Chris Jan 16 '15 at 07:29
  • Just an idea, I can't test it in the moment: May be you can use symlinks on the server for your .htaccess files. Make a htaccess folder with all the files and symlink the neccessary one to the original. – Joerg Jan 16 '15 at 07:40
  • @Joerg This would probably have the same drawbacks as excluding the file from uploading, namely that I would not get changes to the server automatically. – Chris Jan 16 '15 at 08:34
  • PhpStorm doesn't even let you pick hidden files (`.anything`) when editing the ignore list, it seems. But you can enter the path manually and see if that works. – caw Nov 25 '16 at 08:50

1 Answers1

1

The .htaccess files on each server are symlinks to the specified htaccess file in a folder. In this folder you have all your htaccess files from all servers. You skip the upload of the .htaccess files in PhpStorm, but you can change and deploy the files in the htaccess folder.

If you are able to create symlinks for htaccess files on your server, then this solution should work. It's not a clean solution, but better then wrong htaccess files on a server.

Joerg
  • 3,102
  • 2
  • 24
  • 30