Archive for May, 2011

Using HostGator as a remote git repository

May 12th, 2011 3 comments

I do freelance web development, and I’ve been looking for a way to get a remote repository for my work. I tried svn over ssh, no luck. But! Git works!

The first step is to get Shell Access to your Host Gator account. See:

Now, login, and create a git repository somewhere. (I put the git repository in the webroot of the subdomain of the project I’m working on. Now, from the directory of your git repository, type “pwd” and copy down the absolute path to yoru git repository.

Now, create a clone of that repository with your git client (I use msys git with git-gui). The url would be:

ssh://username@domain:2222/(path copied from pwd command)

Viola! It will ask you for your password 2 or 3 times, but it will create a clone of the remote git repository to your directory of choice. Now, you can commit changes locally and periodically push them to your remote repository.

Categories: git, hostgator Tags:

SEO Friendly URL’s in Cake PHP

May 4th, 2011 No comments

I love cake php… It’s awesome.

But one thing I want, is more friendly urls…

i.e. I want /myAccount/index to be /my-account/index

I found a few solutions, but settled on this one, by changing your .htaccess file and adding two RewriteRules you can replace all -‘s with _’s, which will then allow the Cake Router to route the url to the right controller.

The finished .htaccess file should look like this:

RewriteEngine on
RewriteRule ^([^\-]*)\-([^\-]*\-.*) $1_$2 [N]
RewriteRule ^([^\-]*)\-([^\-]*)$ /$1_$2 [N]
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]

Categories: Uncategorized Tags: