Welcome Guest, Not a member yet? Register   Sign In
IS this htaccess ok?
#1

[eluser]behnampmdg3[/eluser]
Hello I am new to CI, I was wondering if this htaccess is enough to ger rid of index.php:
Code:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]

Thank you
#2

[eluser]Barwick[/eluser]
Did you test it? If all you're doing is looking to get rid of the index.php, this should work for you.
Note, in order to access any folders you have outside of the application or system folders (i.e. css, img, js folders like I have), you'll need to specify them in the RewriteCond.

Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|img|css|js|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
#3

[eluser]Mr. Pickle[/eluser]
Why do you use te uri param url= ?
index.php/$1 should be sufficient, I don't know if CI can handle the whole uri in a uri param url.

As for the css, js etc. directories:
It should be enough to if you use:
Code:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
as this states that de routing to the index.php should not take place if a requested directory (-d) or file (-f) exists.
Ignoring certain directories will also ignore files and dir's if they don't exist.
If you for example would like to catch all 404 with CI you should not do this.




Theme © iAndrew 2016 - Forum software by © MyBB