WordPress .htaccess on Red Hat OpenShift PaSS

2019-05-28 11:49发布

I'm developing a website using Wordpress on OpenShift. All is ok, except my .htaccess file. Every time I push code using Git, the .htaccess file becomes blank. Even if I push an .htaccess file from my computer through Git. This means that I have to re-configure pretty permalinks every time I push changes via Git.

I tried SSHing into the server in the directory /var/lib/stickshift/xxxxxxxx/app-root/repo/php - and indeed, before I push any code the .htaccess file is properly populated. The minute I push anything via Git (even when this includes the .htaccess file from my computer) the file is blank.

I'm wondering - perhaps does OpenShift store the .htaccess file somewhere else? But if so, why would it re-set every time I push new code?

If possible, I wouldn't like to move the .htaccess file to a location where I can't access via Git - since it may need to be updated in the future.

If anyone has encountered this issue and has come across a solution, any help/insight would be greatly appreciated.

Regards,

Ian

3条回答
ゆ 、 Hurt°
2楼-- · 2019-05-28 12:29

If you are using the default wordpress for OpenShift it is automagic now.
Just create (and git add) the .htaccess file to your .openshift/config directory.
The deploy action_hook will copy it to the correct directory (/app-root/data/current) at deployment.

查看更多
祖国的老花朵
3楼-- · 2019-05-28 12:30

Well yesterday itself I was playing with Wordpress Multisite on OpenShift and was using .htaccess for configuring sub-directories feature. Locally in the git repo, I created .htaccess file under git_repo/php directory; git add .; git commit; git push and there after the file stayed put in tact. It appears something else is overwriting your .htaccess? Are you using OpenShift action_hooks?

Just to be sure, I created a simple php app and used .htaccess - no wiping of contents here too. Why don't you test this out on your end? And if the problem persists, let me know.

查看更多
Emotional °昔
4楼-- · 2019-05-28 12:30

Try putting .htaccess file to the git ignore

查看更多
登录 后发表回答