where to put wordpress htaccess on openshift - wordpress

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 ?

If you used our official quickstart, you would need to use an action_hook (probably deploy) to copy a .htaccess file into place, otherwise the files are actually not stored in a place that is affected by git. You could also try using this quickstart( https://github.com/openshift-quickstart/openshift-wordpress-developer-quickstart) where EVERYTHING except for uploads, is stored in git (plugins, themes, etc)

Related

AWS Lightsail Wordpress Version control

I'm working on a wordpress site hosted on an AWS Lightsail instance (Bitnami) and i'd like to have version control to work on our site themes with a coworker.
I like the idea of just having to git pull to make changes to the site.
In the wordpress folder (that contains wp-admin, licences, wp-config.php, etc...), there is the wp-content folder but it's a symbolic link that points outside the wordpress folder to root/bitnami/wordpress/wp-content. I can't use git in the wordpress folder but I can set it up in the root/bitnami/wordpress/wp-content but it feels like bad practice since it asks me for admin privileges for every command line.
Is there a reason the wp-content folder is a symbolic link that points to outside the wordpress folder or is it just a mistake from the person who set things up?
Is it okay to use git to bypass an ftp client in this case?
So I just had this same issue today, and I resolved this by moving the directories for .../wp-content to the location of the symlinks and deleting the symlinks.
This was my process (though you could delete the symlinks first):
Move wp-content mv /bitnami/wordpress/wp-content /location/of/wordpress/temporary-directory-name
Delete symlinks rm -f /location/of/wordpress/
Rename temporary-directory-name using move mv /location/of/wordpress/temporary-directory-name /location/of/wordpress/wp-content
You can then repeat the same steps for the wp-config.php file. Once this was done I was able to verify Wordpress was still working on my LightSail instance. Hope this helps

git allow one directory while exclude rest folder in .gitignore fle

I have a Wordpress website in which I have code as shown below:
wp-content/uploads/
which exclude uploads wp-content/uploads/ from git commit. But now I reached to the case where I have to include a subfolder wp-content/uploads/MY_CUSTOM_PDF
How should I only allow MY_CUSTOM_PDF to be included in git commit while ignore the rest as it was earlier.
Solution already exist.!!
.gitignore exclude folder but include specific subfolder
if sometimes git command-line ignore not work due to already uploaded folder so use smartgit ignore unwanted error

WORDPRESS - How to manage code repository with GIT

In wordpress development, we have to deal with upgrade version of plugins and I don't know how to manage code repository with them. actually, we have 3 folders like wp-content, wp-admin, wp-includes, ...
Should I push all of the code which belong to wordpress folder into the GIT repository? Then the new version of plugin will affect to changes of files.
How do I manage the changing of files as less as it can? Should I use .gitignore for it?
Updated: I found the solution at here with the examples. Check this link out
.It is really cool
WordPress can be a joy for running in a GIT repository, this is how I handle it.
I gitignore wp-config.php because that is usually different between local, staging and live sites.
I also gitignore the uploads folder because binary files in git suck and your repo will grow brutally fast. Plus it makes it a pain in the butt to do local development while the site is live.
There are some cool solutions out there, search for Bedrock by Roots for doing interesting deploys, but honestly the simplest way is just to make a repo of the entire install minus the uploads and wp-config.php.
Manually create the wp-config.php on the server.
Use rsync to manage the uploads or you could use FTP if you're not keen on the terminal.
This is the .gitignore file that I use for my projects.
/.idea/
*.log
/wp-includes/
/wp-admin/
/wp-content/advanced-cache.php
/wp-content/backup-db/
/wp-content/backups/
/wp-content/cache/
/wp-content/languages/
/wp-content/plugins/
/wp-content/upgrade/
/wp-content/uploads/
/wp-content/wflogs/
/wp-content/wp-cache-config.php
/.htaccess
/license.txt
/readme.html
I only work with private repositories so I don't have to exclude the wp-config.php.

Excluding files from localgit repo

I am working on a Wordpress site, and been given access to the git repository for this project. The entire WP install is in the Repo. All I care about is being able to push my changes to the theme and a select list of plugin folders, ie:
/wp-content/themes/myTheme2017/
/wp-content/plugins/myPlugin1/
/wp-content/plugins/myPlugin2/
....
How can I exclude everything else from being tracked? How can I update my local WP install, and customize my wp-config.php file, and not have those changes be tracked?
As per How do I configure git to ignore some files locally?, I can specify the files I want excluded much like in gitignore files. Then, I can run git update-index --skip-worktree [<file>...] and get my desired results.
git update-index --skip-worktree wp-config.php
The real question is then can I exclude entire folders? Do I have to run the skip-worktree command on every file?
The real question is then can I exclude entire folders? Do I have to run the skip-worktree command on every file?
Yes, every file: Git does work with content (files), not containers (directories).
You can find here an approach using submodules
git submodule add -f https://github.com/wp-plugins/wp-migrate-db.git ./wp-content/plugins/wp-migrate-db
git commit -m "Added WP Migrate DB plugin"
That allows to commit separately in your parent repo or your submodule.

Unable to create directory wp-content/uploads in Wordpress

I created php files for my plugin and added them to myplugin folder. Then I zipped myplugin folder as myplugin.zip. In Admin Panel of Wordpress I wanted to install my plugin to wordpress. I choosed this zip file and clicked to Install "Now button". Then Wordpress gave an error:
Unable to create directory wp-content/uploads/2013/05. Is its parent directory writable by the server?
What is the problem and how can I solve it? My OS is Linux and I use XAMPP server in my machine.
In your terminal, navigate to the wp-content folder and then run:
chmod -R 0744 plugins
That will set the folder and its subfolders to read/write/execute for you and read for everyone else.
Edit As suggested in the comments, check this out: codex.wordpress.org/Changing_File_Permissions
Alternatively you can just unzip them yourself and save them into this folder:
/wp-content/plugins/name-of-theplugin
Then you can just activate the plugin from the admin page.
I am not entirely familiar with XAMPP but it should be run as a user. Most likely your own windows account. You may try this:
Select the folder wp-content and right click -> properties. then go to Security Tab. There check to see if the User (i.e. you) has write+ modify permission.
Check what is XAMPP server running as, the folder above must have the permissions for the same user.
Double check the "general" tab on the wp-content folder and check the "Attributes" section. Make sure "Read Only is unchecked. If you are changing it, windows will prompt for whether to apply to subfolder. Say "yes".
. Or run XAMPP at Administrator and skip the above step .(assuming it is not production / public internet facing server).
I had this problem yesterday, I solved it by uninstalling the Wordpress module and installing it again as root from the terminal.
I thought if I run the installation wizard as I was logged as root was enough, but it wasn't.
These are the steps for MacOS:
Uninstall wordpress module. Be sure the folder is empty.
Mount the wordpress disk image
cd /volumes/nameOfWordpressModule image
sudo bitnami wordpress module.app/Contents/MacOS/installerbuilder.sh
I recommend you to list the items so you can write exactly the name of the image and app.
Hope it helps!
navigate to your main project folder and run the following:
chmod -R 0777 wp-content
in case of MAC run
sudo chmod -R 777 /Applications/XAMPP/htdocs/

Resources