Explain this mod_rewrite rule?

Begin of line ( = begin group . * = any character, any number of times ) = end group The $1 in the second part is replaced by the group in the first part Is this a Symfony rule? The idea is to pass the whole query string to the index.

Php (the front controller) as a parameter, so that the front controller can parse and route it.

Begin of line ( = begin group . * = any character, any number of times ) = end group The $1 in the second part is replaced by the group in the first part. Is this a Symfony rule?

The idea is to pass the whole query string to the index. Php (the front controller) as a parameter, so that the front controller can parse and route it.

Actually it's from CodeIgniter. So is the front controller doing the rewriting? – meleyal Oct 7 '08 at 16:59 There is no front controller however there is a default_controller.

See the CI documentation. Codeigniter. Com/user_guide/general/routing.

Html – gradbot Oct 7 '08 at 17:03 No, mod_rewrite does the rewriting. I'll post a new answer to explain more, I can't fit it in these 300 characters. – Roel Oct 7 '08 at 17:15.

The browser sends a request to the server (Apache, since you're using mod_rewrite): GET profile/edit Apache accepts this request and sees in its configuration files that you've configured it to pass all requests through mod_rewrite. So, it sends the string 'profile/edit' to mod_rewrite. Mod_rewrite then applies the rules you specified to it, which then transforms the request (in the way I explained in my previous post) to 'index.

Php/profile/edit'. After mod_rewrite is done, Apache continues processing the request, and sees 'oh, this guy is requesting the file index. Php'.

So it calls the php interpreter which then parses and executes index. Php - and gets '/profile/edit' as arguments. The php code (CI in your case) parses these arguments and knows how to call the right module in your application.So basically, it's a way to always call index.

Php, even when the url doesn't specify index.php. In that way, index. Php works as the front controller: it routes all requests to the right location in your application.

Great explanation, thank you. But then how is 'index. Php' getting removed from my URLs?

My URLs look like domain. Com/profile/edit – meleyal Oct 7 '08 at 17:26 What do you mean 'removed'? CI presumably has a way to specify whether or not you want to include 'index.

Php' in the urls you emit (I assume that in CI you need to use function calls to output url's, that's how it works in Symfony - I only have experience with that). – Roel Oct 7 '08 at 17:33 So, that function can determine if the setting to include index. Php in your urls is on or off.

The clients (browsers) only ever see the url without the index.php. On an incoming request, mod_rewrite rewrites adds the index. Php, and the php code doesn't emit urls with index.php.

– Roel Oct 7 '08 at 17:35 There's a config setting 'index_page', the comments say... "If you are using mod_rewrite to remove the page set this variable so that it is blank. " I am using mod_rewrite, but as stated the rules there are adding index.php. So I'm still unsure who/what/how is removing index.

Php from the URLs? :/ – meleyal Oct 7 '08 at 18:50 I still don't understand what your problem is. How do you mean 'removing index.

Php from the URLs'? At what point is it generated, i.e. Where do you put in a version with index.

Php and where does it come out without it? – Roel Oct 7 '08 at 20:06.

If the URL does not start with index. Php or images or css or js or robots. Txt, the string "/index.

Php/" is prefixed. As index. Php is probably an executable php app, the index.

Php then can read the rest of the URL from its cgi environment. (it is stored in ${PATH_INFO}).

Apache accepts this request and sees in its configuration files that you've configured it to pass all requests through mod_rewrite. So, it sends the string 'profile/edit' to mod_rewrite. Mod_rewrite then applies the rules you specified to it, which then transforms the request (in the way I explained in my previous post) to 'index.

After mod_rewrite is done, Apache continues processing the request, and sees 'oh, this guy is requesting the file index. So it calls the php interpreter which then parses and executes index. Php - and gets '/profile/edit' as arguments.

The php code (CI in your case) parses these arguments and knows how to call the right module in your application. So basically, it's a way to always call index. Php, even when the url doesn't specify index.php.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions