Reemoving index.php on localhost |
[eluser]Unknown[/eluser]
Hello, Just started using CI today and I bumped into a problem. When I tried removing index.php from urls using the htaccess lines provided here it didn't work. I'm using local paths like: http://localhost/examplesite/ but the htaccess redirected the request to http://localhost/index.php so adding a '.' before /index.php on the last line from htaccess solved the problem: Code: RewriteCond $1 !^(index\.php|images|robots\.txt) Hope this helps at least someone : )
[eluser]cahva[/eluser]
Yeah thats how paths work. Theres 2 kinds of paths: relative and absolute. If you have path starting with "/" thats absolute path. If you use "./" (which means the current directory) or "../", they are relative to that path where you use .htaccess. You could also use plain "index.php/$1 [L]" as that is the same than using "./index.php/$1 [L]". The plain index.php also goes to relative path category(its relative to the path you're in).
[eluser]Unknown[/eluser]
So using relative paths as I suggested does no harm, yet covers the i-don't-care-where-i-am situation in this case, right?
[eluser]cahva[/eluser]
Yeah, thats it. In RewriteRule its best to use relative path(s) because then it doesnt matter what folder you are installing your app. |
Welcome Guest, Not a member yet? Register Sign In |