Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] Index of/ error with 2.0.1
#1

[eluser]predat0r[/eluser]
Hi,
I have newly installed a 2.0.1 CI, I set the .htaccess file and deleted the index.php from config.. The welcome controller loads well with this setting (so without /index.php/controller), but when I create a controller, the browser lists a directory except loading the view file.

So in view lists the dir structure:

Index of/ci_install/captcha

image1.jpg
image2.jpg
...

My controller name is captcha but the above dir is the CI's captcha dir where the images are generated.
I use the same settings with one of my prev. CI 2.0.1 installation but that works well :/

Any help? Thx
#2

[eluser]WanWizard[/eluser]
You use the "lazy people's" version of htaccess, which test file and directory access (using the -f and -d switches), and redirect everything else to index.php.
Don't do that. Exclude what needs to be excluded, and don't use generic switches.

Note that you can never have a real directory (one that has to be accessable from the URL) and a controller with the same name. Either the directory will be accessed (which happens now) so you can for example load images from it, or a redirect to the controller happens, in which case your images will be inaccesable.

To avoid this, you needs very specific exclusion rewrite rules, that for example do not rewrite for existing image files, but do for directory requests.
#3

[eluser]predat0r[/eluser]
[quote author="WanWizard" date="1300815295"]You use the "lazy people's" version of htaccess, which test file and directory access (using the -f and -d switches), and redirect everything else to index.php.
Don't do that. Exclude what needs to be excluded, and don't use generic switches.

Note that you can never have a real directory (one that has to be accessable from the URL) and a controller with the same name. Either the directory will be accessed (which happens now) so you can for example load images from it, or a redirect to the controller happens, in which case your images will be inaccesable.

To avoid this, you needs very specific exclusion rewrite rules, that for example do not rewrite for existing image files, but do for directory requests.[/quote]

Thanks, I easily changed my controller name, so the script works OK.
I've never known same dir and controller name could cause conflicts.
And I'll check your suggestion about rewrite.




Theme © iAndrew 2016 - Forum software by © MyBB