mod_rewrite |
[eluser]macigniter[/eluser]
Hi Everyone, I just read through the Wiki about the mod_rewrite article: http://codeigniter.com/wiki/mod_rewrite/ For some reason I don't think that the proposed .htaccess file is right... Code: <IfModule mod_rewrite.c> First of all I noticed that the following rule is somehow weird... Code: #Checks to see if the user is attempting to access a valid file, If I get it right this translates to: Code: RewriteCond %{REQUEST_FILENAME} !-f // if the requested file is NOT a file 1. First of all, how can the requested file be NOT a file AND NOT a directory? 1. Then, why is there a ? in the rewrite rule? Shouldn't http://www.domain.com/test be rewritten to http://www.domain.com/index.php/test (not: http://www.domain.com/index.php?/test) 2. As far as I understood mod_rewrite adding /$1 doesn't help redirecting to the index.php but rather adding whatever was typed in the url. So if we want to redirect a bad request to the index.php it should rather be: Code: RewriteRule ^(.*)$ index.php [L] Also I didn't understand why the index.php in the RewriteRules have a leading slash (first rule) for once and then again not (second rule). In my opinion it shouldn't have a leading slash at all if the RewriteBase is set. Altogether I think that this mod_rewrite is not doing what it's supposed to do and only works because of the logical mistakes in the second rewrite rule and the fact that the %{REQUEST_FILENAME} is only matched because a requested file like http://www.domain.com/test is usually not a file nor a directory on the server. Please let me know if my brain took off in some wrong direction after having read way too much about all this mod_rewrite stuff, but it just doesn't seem right what is used in the code above. Let's discuss it! |
Messages In This Thread |
mod_rewrite - by El Forum - 12-06-2009, 08:41 AM
mod_rewrite - by El Forum - 12-06-2009, 09:50 PM
mod_rewrite - by El Forum - 12-07-2009, 03:19 AM
mod_rewrite - by El Forum - 12-07-2009, 03:59 AM
mod_rewrite - by El Forum - 12-07-2009, 04:07 AM
mod_rewrite - by El Forum - 12-07-2009, 05:06 AM
mod_rewrite - by El Forum - 12-07-2009, 05:25 AM
mod_rewrite - by El Forum - 12-07-2009, 06:05 AM
|