Welcome Guest, Not a member yet? Register   Sign In
Code Igniter blocking access to /cgi-bin
#1

[eluser]yello[/eluser]
Hi,

I don't know why but it seems the .htaccess of my CI installation is blocking access to my scripts within the {root}/cgi-bin/ folder.

When I try to access them I get the standard CI 404 Not Found message.

Here is my htacess:

Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

It is very basic as you can see, I don't know why it is not working properlly!
Does anyone can help me fix this issue?

Thanks!
#2

[eluser]Clooner[/eluser]
[quote author="yello" date="1205141343"]
Code:
RewriteBase /
[/quote]

Maybe the cgi-bin is not directly in the rewritebase therefor it misses some of the rules.

But anyway include an exception for anything with "cgi-bin" in your rules and problems should be fixed
#3

[eluser]yello[/eluser]
How do I do that? (i'm sorry but I really suck with mod_rewrite)
#4

[eluser]Clooner[/eluser]
Use
Code:
RewriteCond
#5

[eluser]yello[/eluser]
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/cgi-bin
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

this does not work either
#6

[eluser]Clooner[/eluser]
Try it like this
Code:
RewriteCond %{REQUEST_URI}!(cgi-bin) [NC]

If it doesn't work try this cheat sheet.
#7

[eluser]yello[/eluser]
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI}!(cgi-bin) [NC]
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

doesn't work either, however, I can access /cgi-bin/ now, when trying to launch the .cgi script inside, it doesn't work, 500 Internal Server Error...

What to look for in the cheat sheet? I don't get it
#8

[eluser]Techie-Micheal[/eluser]
This worked for me (for things other than the cgi-bin, but should still work)

Code:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !/dir1
RewriteCond %{REQUEST_URI} !/dir2

RewriteRule ^(.*)$ index.php/$1 [L]

From a glance, it looks like the only difference between what I have and what you have is the spacing.
#9

[eluser]yello[/eluser]
I appreciate your fast anwser but it does not seem to work.

Code:
Code:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !(dir1) [NC]
    RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

That code works... when I try to access domain/dir1 it bypass the rewrite rule... but <b>as soon as I change it to cgi-bin</b> it does not work:
Code:
Code:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !(cgi-bin) [NC]
    RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

I really don't know why it is not working since the only thing I changed is the dir name! Help!
#10

[eluser]Techie-Micheal[/eluser]
[quote author="yello" date="1205314023"]I appreciate your fast anwser but it does not seem to work.

Code:
Code:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !(dir1) [NC]
    RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

That code works... when I try to access domain/dir1 it bypass the rewrite rule... but <b>as soon as I change it to cgi-bin</b> it does not work:
Code:
Code:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !(cgi-bin) [NC]
    RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

I really don't know why it is not working since the only thing I changed is the dir name! Help![/quote] Why are you putting it in parenthesis? I don't think I've seen that before. Have you tried /cgi-bin instead of (cgi-bin)?




Theme © iAndrew 2016 - Forum software by © MyBB