lilmer Posted December 15, 2016 Share Posted December 15, 2016 Hello, I'm just confuse on the way apache and iis react on codeigniter framework accessing folder. on my IIS site when I don't allow folder to be access on web.config it will automatically show codeigniter 404 page as it should be, but on apache its not, its like I have to set 404 on .htaccess by that it will show apache 404 not on framework side. How do I set that accessing not allowed folder on apache will show framework 404. Quote Link to comment Share on other sites More sharing options...
requinix Posted December 15, 2016 Share Posted December 15, 2016 When Apache serves a 404 it uses the ErrorDocument setting. You have two options: 1. Use URL rewriting to rewrite non-existent requests to the framework, thus bypassing the 404 mechanism entirely. This is best. RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ whatever.php [L]2. Use ErrorDocument to make the framework also serve as the 404 page. You say 404 but you're describing 403s. Is that what you mean? You've explicitly forbidden access to something (with an Order/Allow/Deny) and need CI to take over? Quote Link to comment Share on other sites More sharing options...
lilmer Posted December 15, 2016 Author Share Posted December 15, 2016 You say 404 but you're describing 403s. Is that what you mean? You've explicitly forbidden access to something (with an Order/Allow/Deny) and need CI to take over? As I describe on this, "on my IIS site when I don't allow folder to be access on web.config it will automatically show codeigniter 404 page as it should be," its 404 page by CI, not an apache 404. But on linux accessing folder is forbidden because of default index.html on every forbidden folder. Quote Link to comment Share on other sites More sharing options...
requinix Posted December 15, 2016 Share Posted December 15, 2016 Adding a index.html does not automatically forbid access so I think there's something else going on there. IIS is IIS. It's not Apache. It works differently. Just because doing one thing with IIS gets you the result you want doesn't mean that doing the same thing on Apache will too. But I'm still not clear on what you're doing. How are you forbidding access? Is it definitely Apache's 404 page and not its 403 page? If it is the former, have you tried either of the things I said? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.