Jump to content

Recommended Posts

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.

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?

 

 

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.

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?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.