I have cloned my wordpress application from openshift with git, in my cloned application there is php folder, when i put my htaccess file in it then i commit my changes like this :

git add -A
git commit -m 'ok'
git push

My htaccess file is not pushed in the application repository folder on openshift, but when i put it via ftp with filezilla it works, not with git.

I don't know where i have to put .htaccess file ? if it is in php folder, why it's not uploaded ?

  • Have you checked the .gitignore file? Is the .htaccess file being added (git log -p)? – Felix Frank Aug 7 '14 at 10:39
  • there is no .gitignore in php folder there is an empty .gitkeep file, when i type git log -p, it seems that .htacces is present in the last commit, sorry i'm not very familiar with git – Mokrane Aug 7 '14 at 11:21
  • Are you certain that the receiving repository automatically checks out changes that you push to it? That is not standard behavior. – Felix Frank Aug 7 '14 at 11:50
  • When i push to repository other changes are reflected for example wordpress config file, it works, but not for htaccess file in php folder. – Mokrane Aug 7 '14 at 12:32

Create (and git add) a .htaccess in the .openshift/config directory. The deploy action_hook will copy it to the correct directory (/app-root/data/current) at deployment.

  • Thanks for the answer. What about modifying an existing deployment? For example I want to force HTTPS for all traffic. – Tobias J Dec 4 '14 at 20:50
  • Ah nevermind, I guess you already answered it :) Placed it in ~/app-root/data/current and it worked great, thanks. – Tobias J Dec 4 '14 at 20:52
  • Is this preferable over placing in the /php directory? – AlecRust Feb 15 '15 at 0:05

the .htaccess should go in the root directory of your application instead of the /php folder. For example:

wordpress git:(master) ls -la
total 32
drwxr-xr-x  11 User  staff   374 Aug 13 17:03 .
drwxr-xr-x   4 User  staff   136 Aug 13 16:56 ..
drwxr-xr-x  13 User  staff   442 Aug 13 17:07 .git
-rw-r--r--   1 User  staff     9 Aug 13 16:56 .gitignore
-rw-r--r--   1 User  staff   333 Aug 13 17:03 .htaccess
drwxr-xr-x  11 User  staff   374 Aug 13 16:56 .openshift
-rw-r--r--   1 User  staff  2130 Aug 13 16:56 README
-rw-r--r--   1 User  staff  2190 Aug 13 16:56 README.md
drwxr-xr-x   3 User  staff   102 Aug 13 16:56 libs
drwxr-xr-x   3 User  staff   102 Aug 13 16:56 misc
drwxr-xr-x   3 User  staff   102 Aug 13 16:56 php

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.