How to remove (redirect) trailing slashes from URLs using .htaccess

Well… I see a lot of questions regarding SEO friendly URLs, and also regarding the problem with URLs that have trailing slashes which show the same content as the URLs without trailing slashes. Although I really hope that the search engines are smarter than treating those URLs as duplicate content, I feel there is the need to know how to redirect them to the non-trailing slashes URLs.

So here it is. You open .htaccess, and you should have in it the following:

This should work for anything, not just CodeIgniter. Hope this helps…

Alter the way Ion Auth works by using hooks. Get a gravatar after the user logs in

Ion Auth library has something called hooks. These hooks are just what they’re called… Hooks. In there you can attach any code you want by simply writing the appropriate functions. These hooks are triggered inside the library or model at specific moments within the workflow. Continue reading

Register users using Ion Auth in CodeIgniter 3

What we will learn in this episode

OK… We’ve installed Ion Auth and made the login page. How about allowing users to register an account? In this tutorial we will find out how we can use Ion Auth in order to allow users to register for an account. After this we will see how to change the controller so that only administrators can register new users. Continue reading

The migrations in CodeIgniter or how to have a “Git” for your database (part 3 of 3: Using Matches for faster development)

Hmm… I don’t know about you but the two tutorials before this one in the series about migration really scared me with the naming, the controllers, the format of the migration, etc. So why not speed things up? We can do this by using Matches, a CodeIgniter CLI script that helps me speed things up when talking about development in CodeIgniter. I sure hope you didn’t just realize that this is also about promoting my script (which, by the way, it’s open source…). Continue reading

The migrations in CodeIgniter or how to have a “Git” for your database (part 2 of 3: Alter tables with Migrations in CodeIgniter)

(created at: July 23, 2015; last update: July 23, 2015)
Well… you got here. So I will be assuming that you’ve already followed the first episode of this tutorial ( and all went well up until the end. If something went wrong now is the time to tell me (in a comment to to previous tutorial, please).

Now we will go a bit deeper… So… By referring to what we did in the previous tutorial (a table named “users” that has “id”, “username”, “email”, and “password” as fields), we will try to see how we can alter the table the way we want to. Continue reading

The migrations in CodeIgniter or how to have a “Git” for your database (part 1 of 3)

(created at: July 22, 2015; last update: July 29, 2015)

Well… this title is a bit misleading, isn’t it? Let’s just start by talking about what is a Git.

Git is some sort of history tracker for your code. That is, whenever you modify something in your code, Git keeps a track of how the code looked before your update, and how it looks after the update. By using it, you and those that work with you can find out how the coding evolved and return to previous versions if something went wrong or want to create a new branch.

The same happens with the migrations, these being related to the database operations. Migrations help you and your team mates keep track of the changes you make to the database tables.

So let’s get to work and see how we can use them. Continue reading

How to handle security in POST or GET using CodeIgniter

Well… it’s a huge subject, and I don’t know if I’m the person to ask to regarding this subject, but a reader asked me to approach it. Let’s start with mentioning the features that CodeIgniter offer in this regard. Looking at the manual, we can clearly see that it covers a lot of subjects, including session handling, encryption, security, input, and form validation. Continue reading