Welcome Guest, Not a member yet? Register   Sign In
codeigniter overriding cpanel's 'web protect' ?
#1

[eluser]alpineedge3[/eluser]
hi,

I have my codeigniter URIs setup like domain.com/controller, however i also have some real directories (off the framework) that are accessed by domain.com/directory too. i can access both directories and framework controllers, except when I use cpanel's "web-protect" to add .htpasswd protection for a directory.

when i go to domain.com/[protected_directory], i get a codeigniter 404. is there anyway to make the protected directory url avoid getting routed to codeigniter?

thanks
#2

[eluser]Jagar[/eluser]
Are you using an .htaccess for url override or to remove the index.php from the url?
#3

[eluser]alpineedge3[/eluser]
yes my .htaccess does remove the index.php from the url.
#4

[eluser]Jagar[/eluser]
try the following:

Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|web-protect|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
#5

[eluser]Jagar[/eluser]
In the rewritecond add the directory that you do not want codeigniter to treat it as a controller
#6

[eluser]alpineedge3[/eluser]
thanks for your replies. i tried inserting the lines. this is my .htaccess file:

Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond $1 !^(index\.php|images|web-protect|tutor|npscorer|robots\.txt)
    RewriteRule ^(.+)$ index.php?$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
    ErrorDocument 404 /index.php
</IfModule>

it still doesn't work. when I comment out the first two RewriteCond lines, my css files don't load and the protected directories address still bring up a codeigniter 404.

any other suggestions? thanks in advance.
#7

[eluser]Jagar[/eluser]
What happen when you don't comment the first two rewriteconds? Does it still gives you a 404 for web-protect folder?

Also have you tried commenting RewriteBase / ?
#8

[eluser]Jagar[/eluser]
I'm on a shared host with hostmonster and it's apache 2 as the server and on linux and the following is how my .htaccess file looks like.

Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|scripts|bmusic|user_guide|robots\.txt)
RewriteRule ^(.*)$ /index.php?/$1 [L]

ErrorDocument 404 /error
I don't have <Ifmodule... in place, and everything is working fine.
#9

[eluser]alpineedge3[/eluser]
i've tried uncommenting all the lines, some lines, etc. taking out <ifmodule>'s, etc. i'm using apache2 on a shared host as well. Does anyone use cPanel's web-protect feature for directories in the same level as with codeigniter?

that is-

[apache2path]/www/index.php <== CI index
[apache2path]/www/[a non-protected directory] (this lists the folder's file tree just fine)
[apache2path]/www/[web-protected directory] (this brings up CI's default 404)
[apache2path]/www/system <= standard CI system directory

thanks




Theme © iAndrew 2016 - Forum software by © MyBB