0

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 ?

Mokrane
  • 101
  • 1
  • 2
  • Have you checked the `.gitignore` file? Is the `.htaccess` file being added (`git log -p`)? – Felix Frank Aug 07 '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 07 '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 07 '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 07 '14 at 12:32

2 Answers2

3

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.

Fredrik
  • 31
  • 2
  • Thanks for the answer. What about modifying an existing deployment? For example I want to [force HTTPS for all traffic](https://help.openshift.com/hc/en-us/articles/202398810-How-to-redirect-traffic-to-HTTPS-). – Tobias J Dec 04 '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 04 '14 at 20:52
  • Is this preferable over placing in the `/php` directory? – Alec Rust Feb 15 '15 at 00:05
1

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
niharvey
  • 121
  • 1