Apache configuration for segment based URLs

This is a work-in-progress.

There is no evidence that there is any Apache server configuration in my system to enable CodeIgniter to use segment based URLs. So, how come Apache is able to use segment based URLs on my system?

None of the .htaccess files in the CI download directory have anything that would alter the way Apache interprets URLs. And, I don’t recall making any changes to Apache configuration files related to this. Who knows? Maybe Apache (by default) can handle segment based URLs.

First, I’ll go back and take a look at the steps I followed when installing CI. Nope, nothing there.

Next, I went and re-read part of a book I had bought. It indicated that this kind of thing is done using the Apache RewriteEngine On and RewriteRule configuration directives. Those directives were used to convert from a segment based URL to standard URL GET query string—i.e. /index.php?class=member&method=view&param=416

Let me take a look at my Apache configuration to see if such a thing is used.

The only RewriteEngine set of directives I’ve found in my system are the ones I put in the .htaccess file in my CodeIgniter’s install directory next to index.php.

This is the assumption I’ll be making:


When Apache sees a segment in the URL which looks like a file name (i.e. index.php) it looks for a file with that name in the corresponding directory—where it would be. If it finds a file with that name it assumes all the segments which follow it in the URL are GET parameter values which are to be passed to that web page file.

The only place which I have found that talks about a need for the rewriting of the URL to transform it from segment based to GET style was the book I read. The rest of the people on the Web only talk about using rewrites to get rid of the index.php file name from URLs. See my post about the directives for doing this.


About samehramzylabib

See About on https://samehramzylabib.wordpress.com
This entry was posted in CodeIgniter, Configure My Systems, PHP Script Writing. Bookmark the permalink.


Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s