Php (3)

The - I don't want to spend hours reading articles and watching videos - guide to learning Git

By: Hossein Jalali • May 12, 2016

While my days of coding are long gone, my passion for learning and playing with code as a hobby still flares. For every project we begin with I always make sure I understand the architecture and the infrastructure my team at Edoramedia is working on and have major OCD to assuring codes are formatted correctly, commented in the right standard, and OOP is well integrated.

Obviously in order for the team to work in that fashion, using a proper version control platform is essential. Hence the use of Git. At first git seems really overwhelming and unnecessary for the "cowboy" coder, but once you dive deep and learn it properly, there is no going back.

In this article I want to jump into the important parts of Git without giving a whole background of where it came from, who is Linus Trovalds, etc.

Read More

How to get a non-Latin slug from the address bar

By: Hossein Jalali • December 15, 2013

Sometimes when creating websites in Arabic or Farsi we are forced to accept slugs* that are non-Latin, These links usually look nice on the address bar but that is the only place they look good. Once we copy paste that URL and pass it on to others each character turns into a strange ASCII unit. 

Now that can also be acceptable if we were not going to use the slug, but in cases where we use that slug as an identifier for the article, news, or whatever it is associated with, then we have a problem. The problem is that our database has saved the slug in it's non-Latin form while when storing the slug as a variable it dispaly incorrectly.

This is where two lines of code comes in handy.

Read More

The best .htaccess code for CodeIgniter

By: Hossein Jalali • December 2, 2013

After long amount of searching and usually finding available .htaccess files that do not work, I have finally assembled the best .htaccess for codeigniter. This file serves 4 very important needs:

  • Access to important folders: I need to access my images, css, js folders. One line of code on the .htaccess fixes that problem easily.
  • Adding www. to non www. URL's: Another important SEO problem is distinguishing between a URL that has www. at the beginning and one that does not. Search Engines find these as two different links and this could cause SEO problems. With our .htaccess we have resolved that problem.
  • Removal of trailing backslash: Anyone who tries the slightest to make their website more SEO friendly than others has at some point reached this pesky problem of trailing backslashes. Our code fixes the problem with a simple 301 redirect to the no backslash version.
  • IP Canonicalization: Google by default will see your IP address as a second website and in this case will consider a duplicate of your domain. To fix that you must do a 301 redirect from the IP to the actual domain name.
  • Removal of the index.php file: With our .htaccess you can easily have the index.php removed from the end of your domain. Just rememebr to delete the index.php in the config.php as well.

Read below to get access to the file.

Read More