CodeIgniter Forums
htaccess file - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: htaccess file (/showthread.php?tid=16785)

Pages: 1 2


htaccess file - El Forum - 03-16-2009

[eluser]ray73864[/eluser]
What is wrong with this htaccess code?

Code:
Options +FollowSymLinks
Options -Indexes
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|fckeditor|img|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]

For some reason, all requests for /fckeditor/ are going through to index.php (it ends up showing the CI 404 page)

The annoying thing is that this used to work perfectly about a week ago and all of a sudden it doesn't work anymore.

I changed the .htaccess file to this

Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|img|js|css|files|fckeditor|robots\.txt)
RewriteRule ^(.*)$ index.php?/$1 [L]

but it still isn't working.


htaccess file - El Forum - 03-16-2009

[eluser]TheFuzzy0ne[/eluser]
Try using this line instead:
Code:
RewriteCond %{REQUEST_URI} !^(index\.php|fckeditor|img|images|css|js|robots\.txt|favicon\.ico)



htaccess file - El Forum - 03-16-2009

[eluser]ray73864[/eluser]
Changed it to this (using the line you suggested)

Code:
Options +FollowSymLinks
Options -Indexes
DirectoryIndex index.php
RewriteEngine on
RewriteCond %{REQUEST_URI} !^(index\.php|fckeditor|img|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]

But it still hasn't fixed the fckeditor problem, i would post the URL that it is trying to get to, but the forum refuses to let me post it


htaccess file - El Forum - 03-16-2009

[eluser]TheFuzzy0ne[/eluser]
Sorry, I misread your post. If you remove "fckeditor" from your rewrite condition, it should work. RewriteCond %{REQUEST_FILENAME} !-d makes sure that it only gets rewritten if the directory doesn't exist, as it does exist, the request won't be rewritten. Sorry for the confusion.


htaccess file - El Forum - 03-16-2009

[eluser]ray73864[/eluser]
nope, that didn't fix it either.

I forgot to mention before (i slap myself for that), fckeditor itself works fine and shows up on the page fine, the problem seems to be when i try to use the 'filemanager' component of fckeditor.

the filemanager component attempts to load up the following URL :

Code:
/fckeditor/editor/filemanager/browser/default/browser.html?Type=Image&Connector=http://pharmacy.capelcci.org.au/fckeditor/editor/filemanager/connectors/php/connector.php

and then it comes up with the CI 404 page.

if i remove the .htaccess file completely, i get the following

Quote:Forbidden

You don't have permission to access /fckeditor/editor/filemanager/browser/default/browser.html on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

So it would seem that maybe my /fckeditor/ folder has the wrong permissions on it somewhere?


htaccess file - El Forum - 03-16-2009

[eluser]Colin Williams[/eluser]
Code:
RewriteCond %{REQUEST_URI} !^(index\.php|fckeditor|img|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

Your first condition is superfluous. Either use that condition to exclude certain request from being rewritten, or use the bottom two conditions to exclude all requests that can otherwise "serve themselves."


htaccess file - El Forum - 03-16-2009

[eluser]ray73864[/eluser]
Hi Colin, i took out the first line and let the !-f and !-d do there thing, but that didn't fix it either.

reset all directory permissions and without the .htaccess file it still shows the Apache Forbidden thing, yet i can access it just fine if i don't include the query string stuff (it just returns with an XML error.

i find this annoying, as it was working last week Sad


htaccess file - El Forum - 03-16-2009

[eluser]TheFuzzy0ne[/eluser]
I think you're right. It may well be a permissions problem, although I'd have thought that everything would have the same permissions set by default.


htaccess file - El Forum - 03-16-2009

[eluser]Colin Williams[/eluser]
Comment out all your rewrite code and make sure you can get to those URIs in the absence of mod_rewrite. That should be determined first.


htaccess file - El Forum - 03-16-2009

[eluser]ray73864[/eluser]
Ahha, i remove the -f and -d lines and leave the
Code:
RewriteCond %{REQUEST_URI} !^(index\.php|fckeditor|img|images|css|js|robots\.txt|favicon\.ico)
line in there instead, and now instead of a CI 404 page i get a "The URI you submitted has disallowed characters."

however when i change the
Code:
$config['uri_protocol']    = "AUTO";
to
Code:
$config['uri_protocol']    = "PATH_INFO";

the rest of the website breaks, instead of redirecting to the individual controllers it redirects everything to the main controller.