CodeIgniter Forums
Code Igniter blocking access to /cgi-bin - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: Code Igniter blocking access to /cgi-bin (/thread-6727.html)

Pages: 1 2


Code Igniter blocking access to /cgi-bin - El Forum - 03-09-2008

[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!


Code Igniter blocking access to /cgi-bin - El Forum - 03-10-2008

[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


Code Igniter blocking access to /cgi-bin - El Forum - 03-10-2008

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


Code Igniter blocking access to /cgi-bin - El Forum - 03-10-2008

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



Code Igniter blocking access to /cgi-bin - El Forum - 03-10-2008

[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


Code Igniter blocking access to /cgi-bin - El Forum - 03-11-2008

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

If it doesn't work try this cheat sheet.


Code Igniter blocking access to /cgi-bin - El Forum - 03-11-2008

[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


Code Igniter blocking access to /cgi-bin - El Forum - 03-11-2008

[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.


Code Igniter blocking access to /cgi-bin - El Forum - 03-11-2008

[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!


Code Igniter blocking access to /cgi-bin - El Forum - 03-12-2008

[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)?