phplist3 icon indicating copy to clipboard operation
phplist3 copied to clipboard

Htaccess file causes 500 error

Open Tc-001 opened this issue 5 years ago • 10 comments

The following lines in .htacces

<IfModule mod_rewrite.c>
    Options -MultiViews
    RewriteEngine On
    RewriteRule api/v2/ api.php [L]
</IfModule>

cause a 500 error on all pages (website.com/lists, website.com/lists/admin etc...) image

  • phplist version 3.6.0 (was also present in later versions of 3.5.x, when that snippet was first added)
  • php version 7.2
  • I am running this on a sftp-only server, so am not sure how much additional information I can provide.

My workaround for now is commenting them out, then everything works as intended. I am not as experienced with php, so if you need any additional information, let me know.

Tc-001 avatar Jan 14 '21 10:01 Tc-001

The following does not return a 500 error:

<IfModule mod_rewrite.c>
#    Options -MultiViews
    RewriteEngine On
    RewriteRule api/v2/ api.php [L]
</IfModule>

So it seems that htaccess does not like Options -MultiViews for some reason

Tc-001 avatar Jan 14 '21 10:01 Tc-001

Thanks. That entry is for the phpList4 based REST API. This may mean we have to update the system requirements. We will need to check if the API continues to work without that line.

michield avatar Jan 14 '21 11:01 michield

So it should be fine to keep it commented out for now if I don't use the api?

Tc-001 avatar Jan 14 '21 11:01 Tc-001

Yes, that's fine

michield avatar Jan 14 '21 15:01 michield

@Tc-001 Maybe Options -MultiViews is not allowed by your hosting provider 🤔

xh3n1 avatar Jan 25 '21 22:01 xh3n1

Could very well be.

I did a quick test that could not be accurate, as I don't have that much experience with htaccess. By making a .htaccess file in an another directory with a single index.html file and writing Options -MultiViews in it, the website presents me with a 500 error (works fine with empty htacess).

I also sent a message to my provider about this and will update when they respond

Tc-001 avatar Jan 26 '21 11:01 Tc-001

You were right, the provider has disabled this option for "security reasons"

Is there anything that I can do? Probably will have to keep commenting it out for the foreseeable future. For me it's not that big of a deal as I do not plan to use the API anyways.

(Should this be close this? I am not sure if anything else can be done, but the issue still persists, if only on some small number of hosting providers.)

Tc-001 avatar Jan 26 '21 12:01 Tc-001

We can possibly change it to the below, but we'd need to check if that affects the API

<IfModule mod_negotiation.c>
    Options -MultiViews
</IfModule>

michield avatar Jan 26 '21 12:01 michield

That too caused a 500 error, but the following did not:

<ifmodule mod_negotiation.c="">
    Options -MultiViews
</ifmodule>

Taken from here

That is the only place that I found this snippet, so hopefully it does not always return false or other weirdness like that

Tc-001 avatar Jan 26 '21 12:01 Tc-001

ok, interesting. Thanks

michield avatar Jan 26 '21 12:01 michield