Categories
Web Development

Ignore contents of folder with .gitignore

In some cases you might want to keep a folder, but ignore the contents. For example, say we have the following folder structure:

WWW/
    app/
    tmp/
        tmp-file-1.html
        tmp-file-2.html

to keep the “tmp” folder in the repo and keep it empty add the following .gitignore file inside the tmp folder:

# Ignore all files in this folder.
*
!.gitignore

So essentially the new structure should be:

WWW/
    app/
    tmp/
        .gitignore
        tmp-file-1.html
        tmp-file-2.html

If you still have issues after adding this file, sometimes you need to clear your .git cache

Categories
Web Development

Clear .git cache

git rm -r --cached .
git add .
git commit -am 'git cache cleared'
git push origin master

 

Categories
Web Development

Redirect entire domain to HTTPS

Add the following to your .htaccess file

<IfModule mod_rewrite.c>
	RewriteEngine On

	RewriteCond %{SERVER_PORT} 80 
	RewriteRule ^(.*)$ https://mydomain.co.uk/$1 [R,L]
</IfModule>