agentejo / cockpit

Add content management functionality to any site - plug & play / headless / api-first CMS
http://getcockpit.com
MIT License
5.4k stars 524 forks source link

Improved .htaccess security and readability #1404

Open Raruto opened 3 years ago

Raruto commented 3 years ago

List of changes


Additional info

For those interested in deepening I suggest you start reading one of the following examples:

Have a nice Day, Raruto

Raruto commented 3 years ago

PS regarding these two issues:


Some apache (shared) hosts don't allow you to override Options directives (thus getting the error 500: Options not allowed here ... within server logs):

# sample "httpd.conf" with "AllowOverride" set to "None"

<Directory "/var/www/localhost/htdocs">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

As there is no easy way to verify those directives and prevent 500 error (without access to error logs or apache config files), would it make sense to keep them both commented by default?

https://github.com/agentejo/cockpit/blob/722393b31921d5b3ee5992ade63ee9589f5b52a8/.htaccess#L30

https://github.com/agentejo/cockpit/blob/722393b31921d5b3ee5992ade63ee9589f5b52a8/.htaccess#L35

as it happens for the RewriteBase directive:

https://github.com/agentejo/cockpit/blob/722393b31921d5b3ee5992ade63ee9589f5b52a8/.htaccess#L38