I am trying to learn about mod_rewrite.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /indexl.php?/$1 [L]
#When your application folder isn't in the system folder
#This snippet prevents user access to the application folder
#Submitted by: Fabdrol
#Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /indexl.php?/$1 [L]
#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ indexl.php?/$1 [L]
</IfModule>
This is the content of my .htacces file in CI. I use this file because supossedly it works on some other application. However this does not work if I change the name of the index.php I get the directory structure in the browser. So I am wondering if it is working even when the name of the file is index.php, or does it automaticly use index.php. Shouldnt this
RewriteRule ^(.*)$ indexl.php?/$1 [L]
redirect every request to indexl.php???
The RewriteRule snippet redirects depending the URL path given. If you specify an empty one with
http://example.com/, then the-fand-dchecks won’t fail. Thus there will be no rewriting to saidindexl.phpscript.And in absence of any
index.*file (wether .php or .html) Apaches auto index (directory list) will take over.You can however use:
So with an empty path your index script will still run.