Welcome Guest, Not a member yet? Register   Sign In
Reemoving index.php on localhost
#1

[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)
RewriteRule ^(.*)$ ./index.php/$1 [L]

Hope this helps at least someone : )
#2

[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).
#3

[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?
#4

[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.




Theme © iAndrew 2016 - Forum software by © MyBB