Cannot upload - 500 error, probably .htaccess fault

Phoca Gallery - image gallery extension
michalkr53
Phoca Newbie
Phoca Newbie
Posts: 9
Joined: 14 Oct 2019, 14:10

Cannot upload - 500 error, probably .htaccess fault

Post by michalkr53 »

Yesterday I wanted to upload some images, but it didn't work.
When uploading them one by one, I receive a 500 error (Layout "form" not found), and when doing a multiple upload it stops on the first image and doesn't upload it.
I'm using the HTML5 uploader, and everything in the size limit settings and permissions is alright. The files are .jpg, tried different images, filenames are also okay, they are just alphanumeric characters without any spaces or any other special characters. I played around the settings, tried different uploaders etc.

The problem didn't occur a couple of weeks ago, and during that period of time the only thing I changed was my .htaccess file. I added a www to non-www redirect. The redirect is working, didn't mess up anything apart from the image uploading.

Code: Select all

RewriteCond %{HTTP_HOST} www.domain.com
RewriteRule (.*) https://domain.com/$1 [R=301,L]
I'm 90% sure that is the reason of the problem, because when I looked up the server logs, all of the requests were coming from the non-www domain, apart from the Phoca Gallery component, which was accessed from the www version and then immediately redirected to non-www.
The gallery functions as usual (thumbnails, adding already uploaded images, displaying images, adding categories etc.), only the upload process doesn't work.

Is there any way to upload the images, other than FTP and reverting the 301 redirect back to www? Also it's worth noting that I know little to nothing about .htaccess files and how to write the rules.

Screenshot: https://i.imgur.com/nD6DbxM.png
User avatar
KarEm
Phoca Professional
Phoca Professional
Posts: 154
Joined: 20 Dec 2015, 21:25

Re: Cannot upload - 500 error, probably .htaccess fault

Post by KarEm »

Hi,
please try:

Code: Select all

RewriteCond %{SERVER_PORT} !^443$ 
instead off:

Code: Select all

RewriteCond %{HTTP_HOST} www.domain.com
Regards
KarEm
michalkr53
Phoca Newbie
Phoca Newbie
Posts: 9
Joined: 14 Oct 2019, 14:10

Re: Cannot upload - 500 error, probably .htaccess fault

Post by michalkr53 »

Thanks for responding!
Are there any chances that I will mess up the redirect? What concerns me is that the homepage and all of subpages also connect through the port 443, that's what I saw on the firefox's network monitor (https://i.imgur.com/p2fY6pY.png). Won't that exclude these requests from redirecting, thus making them go through the www domain?
User avatar
KarEm
Phoca Professional
Phoca Professional
Posts: 154
Joined: 20 Dec 2015, 21:25

Re: Cannot upload - 500 error, probably .htaccess fault

Post by KarEm »

Hi,
did you set in the .htaccess "RewriteEngine On" and also in the Backend URL Rewrite to yes?
Please also check whether the directory rights on the server are set correctly and have not been changed accidentally.

Regards
KarEm
michalkr53
Phoca Newbie
Phoca Newbie
Posts: 9
Joined: 14 Oct 2019, 14:10

Re: Cannot upload - 500 error, probably .htaccess fault

Post by michalkr53 »

Hello,
URL Rewrite is on and "RewriteEngine On" is included in the .htaccess. I forgot to add that I'm using the default Joomla! .htaccess file and added the non-www redirect in the custom redirects section.
Access rights are set to 755 on directories, and 604 on files everywhere on the server. I believe that these are the default ones.
Also, thanks for responding! I'll be heading off for a couple of hours, so I'll check on anything You respond later.
User avatar
KarEm
Phoca Professional
Phoca Professional
Posts: 154
Joined: 20 Dec 2015, 21:25

Re: Cannot upload - 500 error, probably .htaccess fault

Post by KarEm »

Hi,
access rights to files should be set to 644.

Regards
KarEm
michalkr53
Phoca Newbie
Phoca Newbie
Posts: 9
Joined: 14 Oct 2019, 14:10

Re: Cannot upload - 500 error, probably .htaccess fault

Post by michalkr53 »

Hey,
thanks for Your help! I set the rights as directed to 755 for directories and 644 for files, but the problem still persists.
User avatar
KarEm
Phoca Professional
Phoca Professional
Posts: 154
Joined: 20 Dec 2015, 21:25

Re: Cannot upload - 500 error, probably .htaccess fault

Post by KarEm »

Hi,
I would like to ask you for the following short test: Deactivate the .htaccess by renaming it and set URL rewrite in the backend to No and test if the error still occurs when uploading an image.
Should the error continue to occur, it is not due to the .htacces entries. In this case, please set in Global Configuration - Server-tab the Error Reporting to maximum and post the error message.

Please confirm that you are using the latest versions of Joomla, Phoca Gallery, etc.

Regards
KarEm
michalkr53
Phoca Newbie
Phoca Newbie
Posts: 9
Joined: 14 Oct 2019, 14:10

Re: Cannot upload - 500 error, probably .htaccess fault

Post by michalkr53 »

Hello,
I disabled the .htaccess file and turned off the setting. The file was uploaded without any errors, giving me the "File uploaded" message in the menu.
Thanks for responding, also congrats on the 100th post!
User avatar
Benno
Phoca Hero
Phoca Hero
Posts: 9094
Joined: 04 Dec 2008, 11:58
Location: Germany
Contact:

Re: Cannot upload - 500 error, probably .htaccess fault

Post by Benno »

@KarEm
Thanks for responding, also congrats on the 100th post!
Also from me! :)

Kind regards,
Benno
Post Reply