How to tell if .htaccess is working

I’m creating a Gibbon SIS portal for our school, and am having trouble getting my .htaccess files (Uploads and Htdocs folders) to work:

Changes I make to these files doesn’t seem to affect the site for good or bad. Any suggestions?

Seems working to me

image

image

Which part is not working for you?

4 Likes

This is the part in the Uploads folder I’m wondering about.

The Gibbon system check continues to show these errors, no matter if I change the .htaccess settings.

Is on by default

Please get help from developer

4 Likes

Thanks. To be clear, is this an issue with Gibbon? If so, I will ask them.

Changing PHP settings through htaccess rules requires using the php_value or php_flag options (like you do with the register_globals). Just dumping the PHP settings into the .htaccess file isn’t valid code. I would fully expect this code to just crash your site. Seeing how it doesn’t crash, I strongly suspect the code is never actually reached.

Checking your site, the .htaccess file where you’ve added this settings is located in the uploads folder. That means these rules are only executed when you try to access the /uploads URL on your site. The rest of your site, which is where all the PHP requests go through, do not have these lines, so even if the configuration lines do work, they’re not working because they are in the wrong place.

Actually, this might be the reason why the “Uploads folder not publicly accessible” check may be failing. I’m guessing the entire folder is unreachable because the folder contains invalid .htaccess rules. If that check expects to see a 403 Forbidden error, but it receives a 500 Internal Server Error error, or a 302 redirect to the 500 error page, that could be causing that check to fail.


So, in short:

  • Please restore the .htaccess file in the uploads folder to the original contents, the current contents do not work.
  • The allow_url_fopen setting is already enabled. But we’ve configured it as On, not on. PHP interprets these settings as being the same, but your software does not, which is a bug in the software.
7 Likes

Thank you both for the insight. I’ve restored the .htaccess file in the uploads folder to the original contents, and updated the .htaccess file in the htdocs folder to the following:

I know that Gibbon is reading this file, since I was able to change the values for max_input_vars and max_file_uploads to 5000 and 25 respectively. I will talk with the folks at Gibbon regarding the bug you mentioned on allow_url_open. As for the “Uploads folder not publicly accessible” check, any further thoughts? The file permissions are set for 0755.

Maybe 0777? Although I think the problem is with Gibbon.

I can try, though the Gibbon website says to avoid 0777:

It depends on what “Uploads folder not publicly accessible” means.

My guess is that it has to do with access from the internet. You don’t want people to be able to directly link to files in the uploads folder, as you don’t want people to access documents that they haven’t specifically been given access to.

The way to do that is with .htaccess rules, not file permissions. But it wouldn’t make sense that they ship a .htaccess file for the uploads folder which doesn’t actually meet their own system requirements.

Alternatively, they could be checking for file permissions, and the “publicly accessible” refers to the files being accessible from other users on the server. That’s already the case of course on our hosting. But if Gibbon specifically requires it to be set through file permissions, the permissions to use would be “750”.

7 Likes

Neither 777 nor 750 seem to affect it. I thought the Options -Indexes line might do something, but adding that (or commenting that out) has no impact on the error check either:

I will continue reaching out to Gibbon for any insight.

Most likely this security system is preventing their check from working.

There isn’t really a way around it it seems, because even if you configure it correctly it seems Gibbon won’t allow you to continue because it cannot verify you configured it correctly.

4 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.