contao / manager-bundle

[READ-ONLY] Contao Manager Bundle
GNU Lesser General Public License v3.0
17 stars 10 forks source link

If the .htaccess already exist contao is not placing its own #70

Closed netzarbeiter closed 5 years ago

netzarbeiter commented 6 years ago

Some Webhoster are adding a .htaccess with an AddHandler in the web-folder if you change the PHP version.

For example: AddHandler application/x-httpd-php72 .php

Is it possible to merge the AddHandler during the creation of the .htaccess and overwrite the old version.

While testing the new Contao Manager everything went well, expect updating the database (domain.com/contao/install), while the needed lines in the .htaccess were missing.

Toflar commented 6 years ago

I think that's a quite common case @contao/developers. If the .htaccess only contains AddHandler, I think we could add that, wdyt?

m-vo commented 6 years ago

I don't think merging an .htaccess file is a good idea. There is too much that could go wrong.

(That by the way is another reason why shipping that file is problematic / related disucssion: #58)

Toflar commented 6 years ago

I would do it only if AddHandler and only if AddHandler is present. As soon as there's other content in there, I wouldn't do anything at all.

m-vo commented 6 years ago

Yeah, that would be fine then, I guess. We have to be careful, though. If something in the lines we're adding affects this php setting (and if it's presence is neccessary by the hoster), the server might e.g. deliver unparsed PHP.

Toflar commented 6 years ago

The AddHandler case is just very, very common for virtual hosts, that's why I think that might be worth an exception.

leofeyer commented 6 years ago

I don't think merging an .htaccess file is a good idea. There is too much that could go wrong.

I fully agree with this. We must not mess with an existing .htacces file!

netzarbeiter commented 6 years ago

If you don't want to mess with an existing .htaccess, the Contao Manager should display a warning that the .htaccess could not have been written and were they get it from.

zonky2 commented 6 years ago

maybe it´s possible to write .htaccess-contao if another htaccess exist - it´s easier to copy one content to another htaccess...

leofeyer commented 6 years ago

As discussed in Mumble on August 30th, we want to check the existing .htaccess file for

/^\s*RewriteRule\s/im

and if there is no match, we want to append the .htaccess content. Additionally, we want to provide a .htaccess.default file, so people can look up what needs to be added.

Toflar commented 5 years ago

PR ready: https://github.com/contao/contao/pull/160

leofeyer commented 5 years ago

Thank you @Toflar. 👍